Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 10 months ago.
0

OK. I figured it out by myself.

$subject_list = DB::table('subjects')
->join('users as provider', 'provider.user_id', '=', 'subjects.provider')
->leftjoin('users as replier', 'replier.user_id', '=', 'subjects.replier')
->select('provider.user_name as provider_name', 'replier.user_name as replier_name', 'subjects.*')
->get();
0

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Learner learner Joined 18 Aug 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 Laravel.io - All rights reserved.