/** * Check the request for the presence of a token. * * @param \Illuminate\Http\Request $request * * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException */ public function checkForToken(Request $request) { if (!$this->auth->parser()->setRequest($request)->hasToken()) { throw new BadRequestHttpException('Token not provided'); } }