*/ protected $fillable = [ 'title_part1', 'title_part2', 'title_part3', 'picture', 'picture_alt', 'picture_title', 'presentation_title', 'presentation_content', 'video_id', 'display_video', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'display_video' => 'bool' ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted(): void { static::creating(function () { throw new \RuntimeException("Creating a new page is not authorized"); }); static::updating(function (self $model) { $model->picture = FileStorageHelper::storeFile($model, $model->picture, true); }); static::updated(function (self $model) { FileStorageHelper::removeOldFile($model, 'picture'); }); static::deleting(function () { throw new \RuntimeException('Deleting a page is not authorized'); }); } }