samedi 24 août 2019

Order products table by using orderBy() according to a column in users table [laravel]

I have two tables in the database Products and Users

I have this SQL query

Product::where('status',5)->where('user_id',120)->orderBy('created_at','DESC')->paginate(50)

and I have a column in USERS table called valid_rate

all i need is to order those products by valid_rate column in the users table

to be like that Product::where('status',5)->orderBy('valid_rate','DESC')->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire