I don't understand the structure of your database.
What are you trying to do ? Why 4 different tables ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hello i have 4 tables tableOne : ID, CARPLATE, REPAIR_COST tableTwo: ID, CARPLATE, PORTICS_COST tableThree: ID, CARPLATE, FUEL_COST tableFour: ID,CARPLATE, DRIVER_NAME
how do i connect the tables by "CARPLATE" on models, and make a query of the sum of the cost fields and group them by the carplate in a show.blade.php ? i have been trying but i'm not being able, i suppose it starts with:
public function show()
{
$summaryData = tableFour::with('tableOne')
->leftjoin('tableThree', 'tableFour.CARPLATE', '=', 'tableThree.CARPLATE')
->get();
return view('admin.form.show', compact('summaryData'));
}
please give me example code as i'm having really difficulty on trying to go over concept to the practice.
Please or to participate in this conversation.