33 lines
696 B
PHP
33 lines
696 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'
|
|
];
|
|
}
|
|
}
|