<?php
namespace QxCMS\Modules\Client\Requests\Principals;
use Illuminate\Foundation\Http\FormRequest;
class PrincipalRequest 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' => 'required|min:3|unique:client.principals,name,'.(($this->getId()) ? $this->getId():'NULL'),
'address' => 'required',
'email' => 'required|email|unique:client.principals,email,'.(($this->getId()) ? $this->getId():'NULL')
];
}
public function messages()
{
return [
];
}
public function getId()
{
return decode($this->principal);
}
}