ldc-groupe/app/Http/Requests/Back/UploadFileRequest.php

41 lines
934 B
PHP
Raw Normal View History

2025-09-16 16:44:49 +02:00
<?php
namespace App\Http\Requests\Back;
use App\Traits\Requests\Api\HasLaravelFailedValidation;
2025-09-16 16:44:49 +02:00
use Illuminate\Foundation\Http\FormRequest;
class UploadFileRequest extends FormRequest
{
use HasLaravelFailedValidation;
2025-09-16 16:44:49 +02:00
/**
* 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 [
2026-02-10 15:43:47 +01:00
'upload' => [
'required',
'image',
'mimes:jpeg,png,jpg',
'max:5048',
'dimensions:min_width=567,min_height=567,max_width:1008,max_height:1008',
],
2026-02-12 16:14:11 +01:00
'folder' => 'required|string|between:3,255',
2025-09-16 16:44:49 +02:00
];
}
}