2018-08-06 12:30:51 +00:00
|
|
|
<?php
|
2018-11-08 16:47:27 +00:00
|
|
|
namespace App\Http\Requests\Person;
|
2018-08-06 12:30:51 +00:00
|
|
|
|
|
|
|
use App\Http\Requests\Request;
|
2018-11-08 16:47:27 +00:00
|
|
|
use Illuminate\Validation\Rule;
|
2018-08-06 12:30:51 +00:00
|
|
|
|
2018-11-08 16:47:27 +00:00
|
|
|
class CreatePersonRequest extends Request
|
2018-08-06 12:30:51 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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 [
|
|
|
|
'academic_title' => 'nullable|min:2|max:255',
|
2018-11-08 16:47:27 +00:00
|
|
|
'last_name' => 'required|min:3|max:255|unique_with:persons,first_name,date_of_birth',
|
2018-10-04 14:41:29 +00:00
|
|
|
'first_name' => 'required|min:3|max:255',
|
2018-11-08 16:47:27 +00:00
|
|
|
'email' => 'required|email|max:50|unique:persons,email',
|
|
|
|
// 'email' => [
|
|
|
|
// 'required', 'email', 'max:100',
|
|
|
|
// Rule::unique('persons')->ignore($user->id),
|
|
|
|
// ],
|
2018-08-06 12:30:51 +00:00
|
|
|
'identifier_orcid' => 'nullable|min:19|max:50',
|
2018-11-08 16:47:27 +00:00
|
|
|
'status' => 'required|boolean',
|
2019-09-02 14:58:08 +00:00
|
|
|
'date_of_birth' => 'nullable|date'
|
2018-08-06 12:30:51 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|