mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 09:14:08 +00:00
37 lines
920 B
PHP
37 lines
920 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Services\MailConfigurationService;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class CompanyMailConfigurationRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
if ($this->string('use_custom_mail_config')->toString() !== 'YES') {
|
|
return [
|
|
'use_custom_mail_config' => ['required', 'string', Rule::in(['YES', 'NO'])],
|
|
'mail_driver' => ['nullable', 'string'],
|
|
];
|
|
}
|
|
|
|
return app(MailConfigurationService::class)->validationRules(
|
|
$this->string('mail_driver')->toString(),
|
|
true
|
|
);
|
|
}
|
|
}
|