I am trying to get data from database and print it using foreach loop but I have undefined variable error.
In my web.php I have
Route::get('/ShowProducts' , 'ProductController@ShowProducts');
This is my code in controller
function ShowProducts(){
$show = ProductModel::where('ID')->get();
$show->Product_Name;
$show->Count;
$show->Price;
return view('profile');
}
See Question&Answers more detail:os