ldc-boutique-cnc-sable/app/Actions/Faqs/UpdateFaqInput.php

24 lines
659 B
PHP

<?php
declare(strict_types=1);
namespace App\Actions\Faqs;
use App\Contracts\ActionInput;
use App\Models\Faq;
use Webmozart\Assert\Assert;
final readonly class UpdateFaqInput implements ActionInput
{
public function __construct(
public Faq $faq,
public string $question,
public string $answer,
) {
Assert::stringNotEmpty(trim($this->question), 'Question cannot be empty.');
Assert::minLength(trim($this->question), 4);
Assert::maxLength($this->question, 255);
Assert::stringNotEmpty(trim($this->answer), 'Answer cannot be empty.');
Assert::minLength(trim($this->answer), 4);
}
}