*/ protected $fillable = [ 'title', 'color', 'logo', 'items_by_line', ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted(): void { static::creating(function (self $model) { // * TRANSFORMATIONS $model->logo = FileStorageHelper::storeFile($model, $model->logo, true); }); static::created(fn () => self::removeCached()); static::updating(function (self $model) { // * TRANSFORMATIONS $model->logo = FileStorageHelper::storeFile($model, $model->logo, true); }); static::updated(function (self $model) { FileStorageHelper::removeOldFile($model, 'logo'); self::removeCached(); }); static::deleted(function (self $model) { FileStorageHelper::removeFile($model, 'logo'); self::removeCached(); }); } }