/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $phone = Rules::getRule('phone'); $id = Auth::user()->id; if (Request::get('id')) { $id = Request::get('id'); } //todo if is admin ignore all unique so he can change whatever he wants return ['first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'username' => 'required|unique:users,username,' . $id, 'email' => 'required|email|unique:users,email,' . $id, 'phone' => 'max:255|regex:' . $phone, 'password' => 'confirmed']; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return ['first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'username' => 'required|unique:users', 'email' => 'required|email|unique:users', 'phone' => 'max:255|regex:' . Rules::getRule('phone'), 'password' => 'required|confirmed|min:6']; }