Files
alrahma_sunday_school_api/app/Http/Requests/Parents/UpdateAuthorizedUserRequest.php
T
2026-04-23 00:04:35 -04:00

31 lines
603 B
PHP

<?php
namespace App\Http\Requests\Parents;
use Illuminate\Foundation\Http\FormRequest;
class UpdateAuthorizedUserRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
protected function prepareForValidation(): void
{
if ($this->has('email') && $this->input('email') === '') {
$this->merge(['email' => null]);
}
}
/**
* @return array<string, mixed>
*/
public function rules(): array
{
return [
'email' => ['sometimes', 'nullable', 'string', 'email'],
];
}
}