File: D:/HostingSpaces/SBogers10/reiskick.komma.nl/app/Countries/Kms/CountryController.php
<?php
namespace App\Countries\Kms;
use App\Countries\Country;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Komma\KMS\Core\SectionController;
final class CountryController extends SectionController
{
protected string $slug = "countries";
protected string $classModelName = Country::class;
function __construct()
{
$countrySection = new CountrySection($this->slug);
parent::__construct($countrySection);
}
protected function save(Model $model, Collection $attributesByValueFrom = null): Model
{
$model = parent::save($model, $attributesByValueFrom); // TODO: Change the autogenerated stub
Country::where('id','!=',$model->id)
->where('home_grid_position', $model->home_grid_position)
->update(['home_grid_position' => null]);
return $model;
}
}