51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\DomainNames;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Support\Facades\Auth;
|
||
|
|
|
||
|
|
class StoreDomainNameRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*
|
||
|
|
* @return boolean
|
||
|
|
*/
|
||
|
|
public function authorize()
|
||
|
|
{
|
||
|
|
return Auth::check();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Prepare the data for validation.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
protected function prepareForValidation()
|
||
|
|
{
|
||
|
|
$this->merge([
|
||
|
|
'renew' => $this->renew ? true : false
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
public function rules()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'ascii_name' => 'required|min:2|max:255',
|
||
|
|
'utf8_name' => 'required|min:2|max:255',
|
||
|
|
'expiration_date' => 'required|date',
|
||
|
|
'renew' => 'required|boolean',
|
||
|
|
'related_brand' => 'nullable|min:2|max:255',
|
||
|
|
'redirect_dns' => 'nullable|min:2|max:255',
|
||
|
|
'certificats' => 'nullable|min:2|max:255',
|
||
|
|
'comment' => 'nullable|min:2|max:255'
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|