Пример #1
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $id = $this->route('employee');
     $user_id = 'NULL';
     $employee = Employee::find($id);
     $user = $employee->user;
     if (isset($user)) {
         $user_id = $user->id;
     }
     return ['name' => 'required|max:45', 'sex' => 'required|in:male,female', 'user' => 'required|array', 'user.username' => 'required|max:30|unique:users,username,' . $user_id . ',id,owner_type,Domain\\Employee\\Employee', 'user.email' => 'required|max:255|email|unique:users,email,' . $user_id . ',id,owner_type,Domain\\Employee\\Employee'];
 }