If you defined your route like this:
Route::apiresource('car', 'Api\CarController')
then you can retrieve the resource's id like this: request()->route('car')
or request()->route()->parameters['car]
. If you are inside a request object you can use $this
instead of request()
as well.