api_token ?? ''; $service = Service::getFromBearerToken($bearerToken); $request->request->add(['brand_id' => $service->brand->id]); $response = $next($request); // @codeCoverageIgnoreEnd } else { // Use Laravel auth check mecanism. $response = \call_user_func_array( [$this, 'parent::' . __FUNCTION__], array_merge([$request, $next], $guards) ); } return $response; } /** * Get the path the user should be redirected to when they are not authenticated. * * @param mixed $request * @return string|null * @codeCoverageIgnore */ protected function redirectTo($request) { if (! $request->expectsJson()) { return route('login'); } } }