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

23 lines
614 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace App\Actions\Faqs;
use App\Contracts\ActionInput;
use Webmozart\Assert\Assert;
final readonly class CreateFaqInput implements ActionInput
{
public function __construct(
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);
}
}