38 lines
781 B
PHP
38 lines
781 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Fo;
|
|
|
|
use Illuminate\Contracts\Validation\Validator;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UnsubscribeNewsletterRequest extends FormRequest
|
|
{
|
|
private bool $validated = false;
|
|
|
|
/** @return array<string,mixed> */
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'hashcode' => ['required', 'uuid'],
|
|
];
|
|
}
|
|
|
|
public function getHashcode(): ?string
|
|
{
|
|
return $this->validated ? $this->string('hashcode')->value() : null;
|
|
}
|
|
|
|
#[\Override]
|
|
protected function passedValidation()
|
|
{
|
|
$this->validated = true;
|
|
}
|
|
|
|
#[\Override]
|
|
protected function failedValidation(Validator $validator)
|
|
{
|
|
$this->validated = false;
|
|
}
|
|
}
|