'Bearer '.$lmi_api_key, ])->get('https://lmi.orianna.dev/api/lol-sales'); $response = $response->json(); if ($response['champion_sales'] === null) { logger()->error('LMI has broken'); return abort(503, 'Trying to access array offset on value of type null'); } return $response; }); } catch (\Exception $exception) { if ($exception->getMessage() === 'Trying to access array offset on value of type null') { logger()->error('LMI has broken'); abort(503, 'Sorry, the Sale Rotation is currently under maintenance. Please try again later.'); } else { logger()->error('An error occurred while trying to fetch the Sale Rotation', ['error' => $exception->getMessage()]); abort(500, 'Sorry, an error occurred while trying to fetch the Sale Rotation. Please try again later.'); } } return view('sales.index', ['sales' => $sales]); } }