Update: 2026-07-12 18:53:59
This commit is contained in:
@@ -3,10 +3,19 @@
|
||||
|
||||
require_once __DIR__ . '/../../transit/connect_app.php';
|
||||
|
||||
requireTransitFields(['trip_id', 'driver_transit_id']);
|
||||
if ($transit_user_role !== 'driver') jsonError('Only drivers can access this endpoint', 403);
|
||||
|
||||
$tripId = filterRequest('trip_id', 'int');
|
||||
$driverId = filterRequest('driver_transit_id', 'int');
|
||||
$tripId = filterRequest('trip_id', 'int');
|
||||
if (!$tripId) jsonError('trip_id is required', 400);
|
||||
|
||||
// استخرج سجل السائق من JWT
|
||||
$driverRow = $transit_con->prepare(
|
||||
"SELECT id FROM transit_drivers WHERE main_driver_id=? AND status='active' LIMIT 1"
|
||||
);
|
||||
$driverRow->execute([(string)$transit_user_id]);
|
||||
$driverRec = $driverRow->fetch();
|
||||
if (!$driverRec) jsonError('Driver not found or not active', 403);
|
||||
$driverId = (int)$driverRec['id'];
|
||||
|
||||
$st = $transit_con->prepare(
|
||||
"SELECT id, route_id, status FROM transit_trips WHERE id=? AND driver_id=? LIMIT 1"
|
||||
|
||||
Reference in New Issue
Block a user