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