<?php
namespace QxCMS\Modules\Client\Requests\Principals;
use Illuminate\Foundation\Http\FormRequest;
class ContactPersonRequest 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.principal_contact_persons,name,'.(($this->getId()) ? $this->getId():'NULL').',id,principal_id,'.decode($this->principal),
'position' => 'required',
'email' => 'required|email',
'contact' => 'required',
];
}
public function messages()
{
return [
];
}
public function getId()
{
return decode($this->contact_person);
}
}