I thought that was what I was doing in the route: Route::get('productDetails/{id}', function(App\productDetails $id){ $productId = productDetails::find($id); return view('productDetails'. $productId); });
but when I try to use $productId in the blade, it says it's undefined.
your productDetails should be a class that extends Eloquent Model.. Since you are using type hint, you can just replace $id with $productDetails perhaps, do not type hint your $id with the productDetails if you are passing in an interger id then use find() method. Its either you use Model Type hinting and directly use the argument that is being typehinted then pass it to the view OR just use $id argument without typehint and use find() method.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community