public function authenticate() { $u = Request::get('username'); $p = Request::get('password'); $g = User::ClientUsername($u)->ClientPassword(md5($p))->get(); if (!empty($u) && !empty($p)) { if ($g->count() > 0) { $this->response_text = "Login Successful"; $this->response_status = "Success"; Auth::login(User::find($g[0]->id)); $this->_setSession($g[0]); //print_r(Session::get('')); //print_r($g[0]->id); } else { $this->response_text = "Invalid Email/Password"; $this->response_status = "Failed"; } } else { $this->response_text = "Email and password are required."; $this->response_status = "Failed"; } return array("status" => $this->response_status, "msg" => $this->response_text); //print_r($g[0]->roles[0]->role_name); }
private function _userAuthenticate($user_info) { SomeClass::userInitSession($user_info); $user = User::find($user_info['user_id']); // user_id test 1 is mark.tan Auth::login($user); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }