isConfigured()) { Log::debug('MegaMind: user notification skipped, API is not configured.', [ 'user_id' => $userId, ]); return false; } $url = rtrim(config('megamind.base_url'), '/') . '/' . ltrim(config('megamind.user_path', '/api/m2m/users'), '/'); $response = Http::timeout((int) config('megamind.timeout', 15)) ->acceptJson() ->asJson() ->withToken(config('megamind.token')) ->post($url, [ 'user_id' => $userId, 'lighthouse' => $lighthouse, 'port' => $port, ]); if (!$response->successful()) { throw new RuntimeException(sprintf( 'MegaMind user notification failed (%d): %s', $response->status(), $response->body() )); } Log::info('MegaMind: user notification sent.', [ 'user_id' => $userId, 'lighthouse' => $lighthouse, 'port' => $port, 'status' => $response->status(), ]); return true; } }