'int', 'page_id' => 'int' ]; /** * Perform any actions required after the model boots. * * @return void */ protected static function booted(): void { static::creating(function (self $approach) { $approach->picture = FileStorageHelper::storeFile($approach, $approach->picture, true); }); static::updating(function (self $approach) { $approach->picture = FileStorageHelper::storeFile($approach, $approach->picture, true); }); static::updated(function (self $approach) { FileStorageHelper::removeOldFile($approach, 'picture'); }); static::deleted(function (self $approach) { FileStorageHelper::removeFile($approach, 'picture'); }); } public function category(): BelongsTo { return $this->belongsTo(CategoryApproaches::class, 'category_id'); } public function page(): BelongsTo { return $this->belongsTo(StaticPage::class); } }