public function login(Request $request, Auth $authModel)
 {
     $response = $authModel->loginWithId($request->input());
     // Handle error
     if (array_key_exists('error', $response)) {
         var_dump($response['message']);
         return;
     }
     $user = \Normalizer::user($response['data']);
     $user['token'] = $response['data']['token'];
     // Update session
     \Utils::setLoginSession($user);
     return redirect()->route('home')->withCookie('token', $user['token']);
 }
Beispiel #2
0
 /**
  * Get users detail using username
  *
  * @param $username  - username
  * @param $params 	- extra params (eg, token)
  */
 public function getUserByUsername($username, $params = [])
 {
     $api = "/user/{$username}";
     $resp = $this->call($api, $params);
     return \Normalizer::user($resp['data']);
 }