I have API URL like:
http://example.com/api/driverAcceptOrder?id=bee74e39-ff38-46a6-9e5d-6db799d2be8c&driverId=3453a3a9-7f58-434a-8dab-95c3469e6238
method is POST
and it takes 2 parameter id
and driverId
When I try to run this URL in postman I get:
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Route
Route::post('driverAcceptOrder/{id}/{driverId}', 'ApiDriversController@driverAcceptOrder');
Controller
public function driverAcceptOrder(Request $request, $id, $driverId)
{
$order = Order::findOrFail($id);
$defs = OrderDefaultProgress::where('name', 'Driver OTW ke pelanggan')->first();
$driver = Driver::where('id', $driverId)->with('user')->first();
$order->update(['driver_id' => $driverId]);
return response()->json([
'data' => $driver,
'message' => 'Pengemudi Dalam perjalanan menuju pelanggan.'
], 200);
}
Note
- Route is not restricted by Auth middleware (its public)
- I've added exception to my
VerifyCsrfToken
file as protected $except = ['/api/*'];
Any idea?
question from:
https://stackoverflow.com/questions/65839805/laravel-notfoundhttpexception-on-api 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…