journal-intime/app/Http/Requests/UpdateUser.php

36 lines
864 B
PHP
Raw Normal View History

<?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:min_width=50,min_height=50,max_width=200,max_height=200,ratio=1'
];
}
}