'datetime', 'date_end' => 'datetime', ]; protected $fillable = [ 'title', 'text', 'link_label', 'link', 'link_new_tab', 'slider_id', 'picture', 'alt_text_picture', 'date_start', 'date_end' ]; protected static function boot() { static::creating(function (Slide $slide) { if ($slide->picture) { $slide->picture = Utils::storeImage($slide->picture, $slide->getTable()); } }); static::updating(function (Slide $slide) { if ($slide->picture) { $slide->picture = Utils::storeImage($slide->picture, $slide->getTable()); } }); parent::boot(); } public function slider() { return $this->belongsTo(Slider::class); } }