api_token ?? ''; if ($apiToken === null) { abort(401, 'Le token d\'authentification est incorrect ' . \json_encode($request->all())); } try { $brand = Service::getFromBearerToken($apiToken)->brand; $request->request->add(['brand_id' => $brand->id]); } catch (ModelNotFoundException $e) { abort(401, 'Le token d\'authentification est incorrect ' . $e->getMessage()); } return $next($request); } }