I have a database table categories having columns:
And other table is Food with:
I want to show the food items according to category on webpage.
I'm using laravel 5.2 and I'm newbie.
Join those two tables and fetch the data, here is an example on how you do it without creating a model.
$rows = DB::table('food')->select('food.food_id','food.foodName','categories.categoryName')->join('categories','categories.category_id','=','food.category_id')->where('categories.categoryName', '=', 'breakfast')->get();
you can remove the where('','','') part if you dont want to filter
good luck
You would create models for Food and Category. See here for the documentation: https://laravel.com/docs/5.2/eloquent If you then add relations between both models in those models you can just use Laravels lazy/eager loading to get your data.