/** * Login, do this first * * @return void * @return \Illuminate\Http\Response */ public function login() { if (is_null($this->user)) { $this->user = User::all()->first(); } $response = $this->call('POST', static::$apiPath . '/user/login', ['username' => $this->user->username, 'password' => $this->user->password]); $token = json_decode($response->getContent())->data->api_key; $this->session(['token' => $token]); return $response; }