'timestamp', 'updated_at' => 'timestamp', ]; public function Categories(): BelongsToMany { return $this->belongsToMany('App\Models\Categories', 'produits_categories', 'products_id', 'categories_id'); } public function LignesCommandes(): HasMany { return $this->hasMany('App\Models\Lignes_Commandes', 'produits_id', 'id'); } public function setDataTree(){ foreach($this->Categories as $categorie){ $categorie->setCalculatedFields(); } } }