'array' ]; /** * The attributes that should be cast to Enums. * * @var array */ protected $enumCasts = [ 'type' => EngagementType::class ]; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'title', 'slug', 'seo_title', 'seo_description', 'banner', 'banner_title', 'banner_alt', 'type', 'data' ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted() { static::creating(function (self $model) { $model->banner = ToolboxHelper::storeImage($model, $model->banner); }); static::updating(function (self $model) { ToolboxHelper::removeOldImage($model, 'banner'); $model->banner = ToolboxHelper::storeImage($model, $model->banner); }); static::deleted(function (self $model) { ToolboxHelper::removeImage($model, 'banner'); }); } }