input('api_key', false); if ($api_key === false) { throw new UnauthorizedHttpException(null, 'You did not provide an API key.'); } try { return User::findByApiKey($api_key); } catch (ModelNotFoundException $e) { throw new UnauthorizedHttpException(null, 'The API key you provided was not correct.'); } } /** * Get the providers authorization method. * * @return string */ public function getAuthorizationMethod() { return 'api_key'; } }