56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Bo\Document;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreDocumentRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return auth('backend')->check();
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function prepareForValidation()
|
|
{
|
|
$this->merge([
|
|
'status' => $this->status ? true : false,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'title' => 'required|min:3|max:255',
|
|
'status' => 'required|boolean'
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes()
|
|
{
|
|
return [
|
|
'title' => \trans('titre'),
|
|
'status' => \trans('statut')
|
|
];
|
|
}
|
|
}
|