mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
* Create PHP CS Fixer config and add to CI workflow * Run php cs fixer on project * Add newline at end of file * Update to use PHP CS Fixer v3 * Run v3 config on project * Run seperate config in CI
153 lines
4.0 KiB
PHP
153 lines
4.0 KiB
PHP
<?php
|
|
|
|
namespace Crater\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class MailEnvironmentRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
switch ($this->get('mail_driver')) {
|
|
case 'smtp':
|
|
return [
|
|
'mail_driver' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_host' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_port' => [
|
|
'required',
|
|
],
|
|
'mail_encryption' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_name' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_mail' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
];
|
|
|
|
break;
|
|
|
|
case 'mailgun':
|
|
return [
|
|
'mail_driver' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_mailgun_domain' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_mailgun_secret' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_mailgun_endpoint' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_name' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_mail' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
];
|
|
|
|
break;
|
|
|
|
case 'ses':
|
|
return [
|
|
'mail_driver' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_host' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_port' => [
|
|
'required',
|
|
],
|
|
'mail_ses_key' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_ses_secret' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'mail_encryption' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_name' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_mail' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
];
|
|
|
|
break;
|
|
|
|
case 'mail':
|
|
return [
|
|
'from_name' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_mail' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
];
|
|
|
|
break;
|
|
|
|
case 'sendmail':
|
|
return [
|
|
'from_name' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
'from_mail' => [
|
|
'required',
|
|
'string',
|
|
],
|
|
];
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|