samedi 22 février 2020

Laravel Eloquent Join Using Another table

Hi how to convert this SQL query to Laravel Eloquent?
I have three table: payments, devices and users. Payments table does not store user_id. but table has device_id. And device table also has user_id.
I want to get user name which made payment.

select * from payments p 
join devices d on p.device_id = d.devid
join users u on d.user_id = u.id


via Chebli Mohamed

1 commentaire:

  1. In this fashion my acquaintance Wesley Virgin's adventure starts in this SHOCKING AND CONTROVERSIAL VIDEO.

    As a matter of fact, Wesley was in the army-and shortly after leaving-he revealed hidden, "mind control" secrets that the government and others used to get everything they want.

    These are the exact same methods lots of famous people (especially those who "come out of nowhere") and the greatest business people used to become rich and successful.

    You've heard that you use only 10% of your brain.

    Really, that's because the majority of your BRAINPOWER is UNTAPPED.

    Perhaps that expression has even taken place INSIDE your very own mind... as it did in my good friend Wesley Virgin's mind seven years back, while riding an unregistered, trash bucket of a car with a suspended driver's license and with $3.20 in his pocket.

    "I'm so frustrated with living paycheck to paycheck! When will I finally succeed?"

    You took part in those questions, ain't it right?

    Your own success story is waiting to be written. All you need is to believe in YOURSELF.

    Watch Wesley Virgin's Video Now!

    RépondreSupprimer