picture) { $gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable()); } if ($gamme->banner) { $gamme->banner = Utils::storeImage($gamme->banner, $gamme->getTable()); } }); static::updating(function (Gamme $gamme) { if ($gamme->picture) { $gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable()); } if ($gamme->banner) { $gamme->banner = Utils::storeImage($gamme->banner, $gamme->getTable()); } }); parent::boot(); } public function childGammes() { return $this->hasMany(Gamme::class, 'parent_gamme_id'); } public function parentGamme() { return $this->belongsTo(Gamme::class); } }