mardi 1 décembre 2015

Join in Laravel 5.1

I'm new to Laravel and I'm still working on my Project using this Framework. In my project, I use an SQL JOIN but I don't know how to retrieve/fetch data on the joined table. Can anybody help me on this one? I really appreciate your help. Thanks! Here is a simple example!

$users = DB::table('users')
        ->join('contacts', 'users.id', '=', 'contacts.user_id')
        ->join('orders', 'users.id', '=', 'orders.user_id')
        ->select('users.*', 'contacts.phone', 'orders.price')
        ->get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire