35 lines
917 B
PHP
35 lines
917 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'],
|
|
];
|
|
}
|
|
}
|