Files
alrahma_sunday_school_api/app/Http/Requests/Families/FamilyComposeEmailRequest.php
T
2026-06-11 11:46:12 -04:00

35 lines
918 B
PHP

<?php
namespace App\Http\Requests\Families;
use App\Http\Requests\ApiFormRequest;
class FamilyComposeEmailRequest extends ApiFormRequest
{
protected function prepareForValidation(): void
{
parent::prepareForValidation();
if (! $this->has('html_message') && $this->has('html')) {
$this->merge(['html_message' => $this->input('html')]);
}
}
public function authorize(): bool
{
return auth()->check();
}
public function rules(): array
{
return [
'recipient' => ['required', 'email', 'max:255'],
'subject' => ['required', 'string', 'max:255'],
'html_message' => ['required', 'string'],
'profile' => ['nullable', 'string', 'max:50'],
'reply_to_email' => ['nullable', 'email', 'max:255'],
'reply_to_name' => ['nullable', 'string', 'max:255'],
];
}
}