Level 51
You can use the with / withPivot methods. On mobile atm, if I get chance today, I'll update the example.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
This code only returns the Job Model only.
public function collection()
{
$jobs = Job::with("work")->get();
return $jobs;
}
I need each model rows with their corresponding child rows to appear inside it , just like nested table.
Please or to participate in this conversation.