36 lines
874 B
PHP
36 lines
874 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class UpdateUser extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return !Auth::guest();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'name' => 'required|min:4|max:255',
|
|
'email' => 'required|email:rfc|unique:users,email,'.Auth::user()->getAuthIdentifier(),
|
|
'encrypt_messages' => 'boolean',
|
|
'notification_hour' => 'in:0,1,2,3,4',
|
|
'avatar' => 'file|dimensions:max_width=200,max_height=200,ratio=1'
|
|
];
|
|
}
|
|
}
|