serverKey)) { return PushResult::failure('fcm_not_configured'); } try { $response = Http::withHeaders([ 'Authorization' => 'key='.$this->serverKey, 'Content-Type' => 'application/json', ])->timeout(10)->post($this->endpoint, [ 'to' => $token, 'notification' => ['title' => $title, 'body' => $body], 'data' => $data, ]); } catch (ConnectionException $e) { return PushResult::failure('connection_failed'); } if (! $response->successful()) { Log::warning('FCM send failed', ['status' => $response->status(), 'body' => $response->body()]); return PushResult::failure('provider_error_'.$response->status()); } $msgId = (string) ($response->json('message_id') ?? $response->json('multicast_id') ?? ''); return PushResult::success($msgId !== '' ? $msgId : null); } }