validate(['token' => 'required|string']); $user = auth()->user(); $user->fcm_token = $request->token; $user->save(); return response()->json(['message' => 'FCM token saved']); } public function sentNotification(FirebaseService $firebase) { $token = auth()->user?->fcm_token; if ($token) { $firebase->sendNotification( $token, 'A Push notification', 'Check the latest reply on your push notification.', ); } // Logic to send notification using Firebase return response()->json(['message' => 'Notification sent']); } }