'json', 'created_at' => 'timestamp', 'updated_at' => 'timestamp', ]; public function Client(): BelongsTo { return $this->belongsTo('App\Models\Clients', 'clients_id', 'id'); } public function LignesCommandes(): HasMany { return $this->hasMany('App\Models\Lignes_Commandes', 'commandes_id', 'id'); } public function setDataTree() { if($this->clients_id > 0) { $this->Client->setCalculatedFields(); } foreach($this->LignesCommandes as $lc) { $lc->setCalculatedFields(); } } }