Page::class ]; protected $fillable = [ 'title', 'subtitle', 'text', 'picture' 'alt_text_picture', ]; protected static function boot() { static::creating(function (Moment $moment) { if ($moment->picture) { $moment->picture = Utils::storeImage($moment->picture, $moment->getTable()); } }); static::updating(function (Moment $moment) { if ($moment->picture) { $moment->picture = Utils::storeImage($moment->picture, $moment->getTable()); } }); parent::boot(); } }