ldc-boutique-cnc-sable/app/Queries/Settings/GetSettingsQuery.php

31 lines
646 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace App\Queries\Settings;
use App\Contracts\Query;
use App\Contracts\QueryInput;
use App\Contracts\QueryInputEmpty;
use App\Dto\SettingDto;
use App\Models\Setting;
use Webmozart\Assert\Assert;
/**
* @implements \App\Contracts\Query<\App\Contracts\QueryInputEmpty, \App\Dto\SettingDto>
*/
final readonly class GetSettingsQuery implements Query
{
public function __invoke(QueryInput $input): SettingDto
{
Assert::isAOf(
$input,
QueryInputEmpty::class,
);
$setting = Setting::getSingleton();
return SettingDto::fromModel($setting);
}
}