ldc-groupe/app/Http/Requests/Back/UploadFileRequest.php
2026-02-12 16:14:11 +01:00

40 lines
934 B
PHP

<?php
namespace App\Http\Requests\Back;
use App\Traits\Requests\Api\HasLaravelFailedValidation;
use Illuminate\Foundation\Http\FormRequest;
class UploadFileRequest extends FormRequest
{
use HasLaravelFailedValidation;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check() and $this->ajax();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
'upload' => [
'required',
'image',
'mimes:jpeg,png,jpg',
'max:5048',
'dimensions:min_width=567,min_height=567,max_width:1008,max_height:1008',
],
'folder' => 'required|string|between:3,255',
];
}
}