22 lines
614 B
PHP
22 lines
614 B
PHP
<?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);
|
|
}
|
|
}
|