do you have a soft deleted trait? thats the only thing i can think of - also install debugbar or 'listen' to the queries (check the doc) - to see what query laravel is doing and do that in your DB directly
Jan 2, 2019
17
Level 13
route model binding returns empty model
Using model binding for some routes I realized the returned model is empty.
I already checked my naming and for me everything seems fine:
| | GET|HEAD | item/{product} | | App\Http\Controllers\TestController@getProductPage | web
Inside my controller:
public function getProductPage(Request $request, Product $product){
dd($product);
}
My product model:
public function getRouteKeyName()
{
return 'id';
}
The returned object of type Product is empty, just the default attributes are set like:
#primaryKey: "id" #keyType: "int" +incrementing: true #with: [] #withCount: [] #perPage: 15 +exists: false
Level 104
Did you mess with the web middleware group to remove the SubstituteBindings middleware?
4 likes
Please or to participate in this conversation.