C
C
cadaver2016-10-25 15:10:54
Laravel
cadaver, 2016-10-25 15:10:54

How to display data from two tables in Laravel?

There is a table with categories (id, name)
There is a table with products (id, name, price,attr)
There is a table with assigned categories (id, product_id, category_id)
How to add a category parameter?

$take = 10;
$offset = $request->offset;		
$cat = $request->category; //array
$price = $request->price;     
$attr = $request->attr;  
 
$places = Place::where()->orderBy('price', 'desc')->skip($offset)->take($take)->get();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question