Hey Peeps, I've been going over this issue for more than a day now, and I can't figure it out.
I have this route:
GET|HEAD api/v1/company/{company}/client/{client}/my-orders
where substitute bindings gets exectuted.
the route file looks like this:
Route::get('company/{company}/client/{client}/my-orders', [OrderController::class, 'myOrders'])
->middleware([Member::class, 'can:view-request,company'])
->name('api.order.add-request');
in the member middleware there is a check performed that checks if it is part of the users companies... This works.
however... when i do the exact same thing... but with a POST...
Route::post('company/{company}/client/{client}/my-orders', [OrderController::class, 'addRequest'])
->middleware([Member::class, 'can:add-request,company'])
->name('api.order.add-request');
the models do not get resolved by susbtituteBindings... I get an error:
Call to a member function getKey() on string
is this case it is referring to {company} that does not get resolved in the post.
I have checked if substituteBindings is called -> it is.
Can some please explain me why model resolving does not work on post requests?