2026-09-29 15:10:29 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-11-10 14:28:00 +01:00
|
|
|
namespace App\Cqs\Actions\Pages;
|
2026-09-29 15:10:29 +02:00
|
|
|
|
|
|
|
|
use App\Contracts\Action;
|
|
|
|
|
use App\Contracts\ActionInput;
|
|
|
|
|
use App\Models\Page;
|
|
|
|
|
use Webmozart\Assert\Assert;
|
|
|
|
|
|
|
|
|
|
/**
|
2026-11-10 14:28:00 +01:00
|
|
|
* @implements \App\Contracts\Action<\App\Cqs\Actions\Pages\UpdatePageInput, \App\Models\Page>
|
2026-09-29 15:10:29 +02:00
|
|
|
*/
|
|
|
|
|
final class UpdatePage implements Action
|
|
|
|
|
{
|
|
|
|
|
/**
|
2026-11-10 14:28:00 +01:00
|
|
|
* @param \App\Cqs\Actions\Pages\UpdatePageInput $input
|
2026-09-29 15:10:29 +02:00
|
|
|
*/
|
|
|
|
|
#[\Override]
|
|
|
|
|
public function __invoke(ActionInput $input): Page
|
|
|
|
|
{
|
|
|
|
|
Assert::isInstanceOf($input, UpdatePageInput::class);
|
|
|
|
|
|
|
|
|
|
$page = $input->page;
|
|
|
|
|
$page->fill([
|
|
|
|
|
'seo_title' => $input->seo->title,
|
|
|
|
|
'seo_description' => $input->seo->description,
|
|
|
|
|
'title' => $input->title,
|
|
|
|
|
'content' => $input->content,
|
|
|
|
|
]);
|
|
|
|
|
$page->saveOrFail();
|
|
|
|
|
|
|
|
|
|
return $page;
|
|
|
|
|
}
|
|
|
|
|
}
|