031e499819
API CI/CD / Validate (composer + pint) (push) Successful in 3m10s
API CI/CD / Test (PHPUnit) (push) Failing after 6m49s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 1m0s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
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')]);
|
|
}
|
|
|
|
if (! $this->has('recipient') && $this->has('to')) {
|
|
$this->merge(['recipient' => $this->input('to')]);
|
|
}
|
|
}
|
|
|
|
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'],
|
|
'return_url' => ['nullable', 'string', 'max:2048'],
|
|
];
|
|
}
|
|
}
|