*/ protected $fillable = [ 'title', 'picture', 'picture_alt', 'picture_title', 'jobs_list', 'job_url', 'published', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'jobs_list' => 'array', ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted(): void { static::creating(function (self $profession) { $profession->picture = FileStorageHelper::storeFile($profession, $profession->picture, true); }); static::updating(function (self $profession) { $profession->picture = FileStorageHelper::storeFile($profession, $profession->picture, true); }); static::updated(function (self $profession) { FileStorageHelper::removeOldFile($profession, 'picture'); }); static::deleted(function (self $profession) { FileStorageHelper::removeFile($profession, 'picture'); }); } }