Fix: Profile visibility, Wallet login alias, and Notification Page crash
This commit is contained in:
@@ -420,6 +420,11 @@ class AuthController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function passengerWalletLogin(Request $request): JsonResponse
|
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([
|
$request->validate([
|
||||||
'phone' => 'required|string',
|
'phone' => 'required|string',
|
||||||
'password' => 'required|string',
|
'password' => 'required|string',
|
||||||
@@ -472,6 +477,11 @@ class AuthController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function driverWalletLogin(Request $request): JsonResponse
|
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([
|
$request->validate([
|
||||||
'phone' => 'required|string',
|
'phone' => 'required|string',
|
||||||
'password' => 'required|string',
|
'password' => 'required|string',
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class NotificationController extends Controller
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['status' => 'success', 'data' => $notifications]);
|
return response()->json(['status' => 'success', 'data' => $notifications, 'message' => $notifications]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PUT /v2/notifications/{id}/read */
|
/** PUT /v2/notifications/{id}/read */
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class PromoController extends Controller
|
|||||||
})
|
})
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
return response()->json(['status' => 'success', 'data' => $promos]);
|
return response()->json(['status' => 'success', 'data' => $promos, 'message' => $promos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** GET /v2/promos/check?code=XXX */
|
/** GET /v2/promos/check?code=XXX */
|
||||||
|
|||||||
@@ -128,8 +128,12 @@ class RatingController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** GET /v2/ratings/passenger/{id} */
|
/** 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')
|
$ratings = DB::connection('primary')->table('ratingPassenger')
|
||||||
->where('passenger_id', $id)
|
->where('passenger_id', $id)
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class Driver extends Model
|
|||||||
|
|
||||||
public function scopeActive($query)
|
public function scopeActive($query)
|
||||||
{
|
{
|
||||||
return $query->where('status', 'notDeleted');
|
return $query->whereIn('status', ['notDeleted', 'active']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeById($query, string $driverId)
|
public function scopeById($query, string $driverId)
|
||||||
|
|||||||
@@ -63,6 +63,6 @@ class Passenger extends Model
|
|||||||
|
|
||||||
public function scopeActive($query)
|
public function scopeActive($query)
|
||||||
{
|
{
|
||||||
return $query->where('status', 'notDeleted');
|
return $query->whereIn('status', ['notDeleted', 'active']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ Route::prefix('v2')->middleware(['hmac.auth', 'jwt.auth'])->group(function () {
|
|||||||
Route::get('/ratings/app', [RatingController::class, 'getAppFeedback']);
|
Route::get('/ratings/app', [RatingController::class, 'getAppFeedback']);
|
||||||
Route::post('/ratings/app', [RatingController::class, 'storeAppFeedback']);
|
Route::post('/ratings/app', [RatingController::class, 'storeAppFeedback']);
|
||||||
Route::get('/ratings/driver/{id}', [RatingController::class, 'driverRating']);
|
Route::get('/ratings/driver/{id}', [RatingController::class, 'driverRating']);
|
||||||
|
Route::get('/ratings/passenger', [RatingController::class, 'passengerRating']);
|
||||||
Route::get('/ratings/passenger/{id}', [RatingController::class, 'passengerRating']);
|
Route::get('/ratings/passenger/{id}', [RatingController::class, 'passengerRating']);
|
||||||
|
|
||||||
// ── Promos ──
|
// ── Promos ──
|
||||||
|
|||||||
Reference in New Issue
Block a user