<?php
namespace App\Http\Requests\V1;
use Dingo\Api\Http\FormRequest;
class UpdateUserRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'sometimes|required',
'email' => 'sometimes|required|email|unique:users',
'password' => 'sometimes|required',
'roles' => 'sometimes|required|array',
'roles.*' => 'required|exists:roles,name',
];
}
public function messages()
{
return [
'roles.*.exists' => 'Role not exist',
];
}
}