Fix: Profile visibility, Wallet login alias, and Notification Page crash

This commit is contained in:
Hamza-Ayed
2026-04-24 00:36:08 +03:00
parent e78bfc6b5c
commit 69993ff775
7 changed files with 20 additions and 5 deletions

View File

@@ -420,6 +420,11 @@ class AuthController extends Controller
*/
public function passengerWalletLogin(Request $request): JsonResponse
{
// Allow 'id' as an alias for 'phone'
if (!$request->has('phone') && $request->has('id')) {
$request->merge(['phone' => $request->input('id')]);
}
$request->validate([
'phone' => 'required|string',
'password' => 'required|string',
@@ -472,6 +477,11 @@ class AuthController extends Controller
*/
public function driverWalletLogin(Request $request): JsonResponse
{
// Allow 'id' as an alias for 'phone'
if (!$request->has('phone') && $request->has('id')) {
$request->merge(['phone' => $request->input('id')]);
}
$request->validate([
'phone' => 'required|string',
'password' => 'required|string',

View File

@@ -40,7 +40,7 @@ class NotificationController extends Controller
->get();
}
return response()->json(['status' => 'success', 'data' => $notifications]);
return response()->json(['status' => 'success', 'data' => $notifications, 'message' => $notifications]);
}
/** PUT /v2/notifications/{id}/read */

View File

@@ -32,7 +32,7 @@ class PromoController extends Controller
})
->get();
return response()->json(['status' => 'success', 'data' => $promos]);
return response()->json(['status' => 'success', 'data' => $promos, 'message' => $promos]);
}
/** GET /v2/promos/check?code=XXX */

View File

@@ -128,8 +128,12 @@ class RatingController extends Controller
}
/** GET /v2/ratings/passenger/{id} */
public function passengerRating(string $id): JsonResponse
public function passengerRating(Request $request, string $id = null): JsonResponse
{
$id = $id ?? $request->input('passenger_id');
if (!$id) {
return response()->json(['status' => 'failure', 'message' => 'Passenger ID required'], 400);
}
$ratings = DB::connection('primary')->table('ratingPassenger')
->where('passenger_id', $id)
->orderBy('created_at', 'desc')

View File

@@ -94,7 +94,7 @@ class Driver extends Model
public function scopeActive($query)
{
return $query->where('status', 'notDeleted');
return $query->whereIn('status', ['notDeleted', 'active']);
}
public function scopeById($query, string $driverId)

View File

@@ -63,6 +63,6 @@ class Passenger extends Model
public function scopeActive($query)
{
return $query->where('status', 'notDeleted');
return $query->whereIn('status', ['notDeleted', 'active']);
}
}

View File

@@ -124,6 +124,7 @@ Route::prefix('v2')->middleware(['hmac.auth', 'jwt.auth'])->group(function () {
Route::get('/ratings/app', [RatingController::class, 'getAppFeedback']);
Route::post('/ratings/app', [RatingController::class, 'storeAppFeedback']);
Route::get('/ratings/driver/{id}', [RatingController::class, 'driverRating']);
Route::get('/ratings/passenger', [RatingController::class, 'passengerRating']);
Route::get('/ratings/passenger/{id}', [RatingController::class, 'passengerRating']);
// ── Promos ──