ldc-com-app-bo/app/Http/Requests/Bo/Documents/StoreDocumentRequest.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2023-03-31 17:38:44 +02:00
<?php
2023-04-05 17:20:30 +02:00
namespace App\Http\Requests\Bo\Documents;
2023-03-31 17:38:44 +02:00
2023-04-05 17:20:30 +02:00
use App\Enums\Documents\LangEnum;
2023-03-31 17:38:44 +02:00
use Illuminate\Foundation\Http\FormRequest;
2023-04-05 17:20:30 +02:00
use Kwaadpepper\Enum\Rules\EnumIsValidRule;
2023-03-31 17:38:44 +02:00
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 [
2023-04-05 17:20:30 +02:00
'uuid' => 'required|min:3|max:255',
2023-03-31 17:38:44 +02:00
'title' => 'required|min:3|max:255',
2023-04-05 17:20:30 +02:00
'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)
],
2023-03-31 17:38:44 +02:00
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes()
{
return [
'title' => \trans('titre'),
];
}
}