Support the ongoing development of Laravel.io →
Input Database

Hello everyone, I am trying to join multiple tables in my controller.php but i am getting errors. I managed to join two tables into an Array like that;

     $currentValues = DashboardMapItem::where('system_id', $system_id)->orderby('datetime', 'DESC')
                  ->select()->join('device_data_current', function($join){
                                    $join->on('device_data_current.id', '=', 'dashboard_map_items.device_id');
                                    $join->on('device_data_current.command', '=', 'dashboard_map_items.command');
                  })
                  ->get();

but I cannot add the third table (devices) to the code, can anyone help me?

Thanks,

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

AlbertDem albertdem Joined 3 Jun 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.

© 2025 Laravel.io - All rights reserved.