'json', 'created_at' => 'timestamp', 'updated_at' => 'timestamp', ]; public function Commandes(): \Illuminate\Database\Eloquent\Relations\HasMany { return $this->hasMany('App\Models\Commandes', 'clients_id', 'id'); } public function setDataTree() { foreach($this->Commandes as $commande) { $commande->setCalculatedFields(); $commande->setDataTree(); } } }