Support the ongoing development of Laravel.io →
Database Eloquent Blade
Last updated 1 year ago.
0

you need to pass the data to the view: http://laravel.com/docs/5.0/views

0

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.

0

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.

Last updated 8 years ago.
0

Also, looking at your routes, you did not call any controller.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

sbd12b sbd12b Joined 26 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.