| Q | A
| ----------------- | ---
| Bug? | no
| New Feature? | yes
| Framework | Laravel
| Framework version | 5.5
| Package version | 2.0.0-alpha1
| PHP version | 7.0.20
I do the following settings in the routing
$api->version('v1', ['namespace' => 'App\Http\Api\V1\Controllers'], function ($api) {
$api->resource('applys', 'ApplysController');
});
I am on the controller below
public function destroy(Apply $apply)
{
return $apply;
}
My request http://www.demo.com/api/applys/11 Get the structure is null, but in fact there is data
But when I route the following settings, the structure is normal
Route::resource('applys', '\App\Http\Api\V1\Controllers\ApplysController');
And the following is also problematic
$api->version('v1', ['namespace' => 'App\Http\Api\V1\Controllers'], function ($api) {
$api->get('applys/{applys}', function (\App\Models\Apply $apply) {
return $apply->id; // The big one here is null
})
});
Laravel 5.6 same issue
Adding bindings middleware to route group solve problem
Most helpful comment
Adding
bindingsmiddleware to route group solve problem