Applied manual JWT check and restored all driver fields2

This commit is contained in:
Hamza-Ayed
2026-04-25 13:32:35 +03:00
parent e306217806
commit ee9c0f3a04
11 changed files with 36 additions and 257 deletions

View File

@@ -46,17 +46,15 @@ class ProfileController extends Controller
$data = $this->enc->decryptFields($data, Passenger::ENCRYPTED_FIELDS);
unset($data['password'], $data['api_secret']);
// Attach wallet balance
$wallet = DB::connection('primary')->table('passengerWallet')
->where('passenger_id', $id)->first();
$data['wallet_balance'] = $wallet->balance ?? '0.00';
// Note: Wallet balance is managed by the dedicated payment server.
// Flutter fetches it directly via the wallet JWT token.
// Attach rating
$rating = DB::connection('primary')->table('ratingPassenger')
->where('passenger_id', $id)->avg('rating');
$data['rating'] = round($rating ?? 5.0, 2);
return response()->json(['status' => 'success', 'data' => $data]);
return response()->json(['status' => 'success', 'message' => $data]);
}
/**
@@ -89,16 +87,14 @@ class ProfileController extends Controller
// Rating
$data['rating'] = $driver->getAverageRating();
// Wallet Balance
$wallet = DB::connection('primary')->table('captain_wallet')
->where('captain_id', $id)->first();
$data['wallet_balance'] = $wallet->balance ?? '0.00';
// Note: Wallet balance is managed by the dedicated payment server.
// Flutter fetches it directly via the wallet JWT token.
// Ride count
$data['ride_count'] = DB::connection('ride')->table('ride')
->where('driver_id', $id)->where('status', 'finish')->count();
return response()->json(['status' => 'success', 'data' => $data]);
return response()->json(['status' => 'success', 'message' => $data]);
}
/**