HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Pages/Kms/PageController.php
<?php

namespace App\Pages\Kms;



use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Komma\KMS\Core\SectionController;
use App\Pages\Models\Page;
use App\Pages\Models\PageTranslation;

final class PageController extends SectionController
{
    protected $sortable = true;
    protected string $slug = "pages";
    protected string $classModelName = Page::class;
    protected ?string $forTranslationModelName = PageTranslation::class;

    /**
     * @var PageRouteService
     */
    private $routeService;

    /**
     * Constructor
     */
    public function __construct()
    {
        $pageSection = new PageSection($this->slug);
        parent::__construct($pageSection);
        $this->routeService = new PageRouteService();
    }

    protected function save(Model $model, Collection $attributesByValueFrom = null): Model
    {
        parent::save($model, $attributesByValueFrom);
        $this->routeService->createOrUpdateRoutesForModelsTranslationsIfChanged($model);
        return $model;
    }

    protected function destroyForModel(Model $model)
    {
        $this->authorize('destroy', $model);
        $this->routeService->destroyForModel($model);
        return parent::destroyForModel($model); // TODO: Change the autogenerated stub
    }
}