28 lines
547 B
PHP
28 lines
547 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class AvatarUploadRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'avatar' => [
|
|
'required',
|
|
'file',
|
|
'image',
|
|
'max:2048',
|
|
'mimes:jpg,jpeg,png,webp',
|
|
'mimetypes:image/jpeg,image/png,image/webp',
|
|
],
|
|
];
|
|
}
|
|
}
|