ldc-com-app-bo/app/Http/Requests/Bo/Documents/StoreDocumentRequest.php
2023-04-17 15:11:45 +02:00

53 lines
1.2 KiB
PHP

<?php
namespace App\Http\Requests\Bo\Documents;
use App\Enums\Documents\LangEnum;
use Illuminate\Foundation\Http\FormRequest;
use Kwaadpepper\Enum\Rules\EnumIsValidRule;
class StoreDocumentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return auth('backend')->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'uuid' => 'required|min:3|max:255',
'title' => 'required|min:3|max:255',
'type' => 'required|min:3|max:255',
'directory_id' => 'sometimes|nullable|integer',
'document_id' => 'sometimes|nullable|integer',
'path' => 'required|min:3|max:255',
'lang' => [
'required',
new EnumIsValidRule(LangEnum::class)
],
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes()
{
return [
'title' => \trans('titre'),
];
}
}