I've got a model that has 4 relationships to the same table.
public function driver()
{
return $this->belongsTo( Admin::class );
}
public function rejectedBy()
{
return $this->belongsTo( Admin::class, 'rejected_by' );
}
public function reconciledBy()
{
return $this->belongsTo( Admin::class, 'reconciled_by' );
}
public function updatedBy()
{
return $this->belongsTo( Admin::class, 'updated_by' );
}
When I eager load all 4 relationships, the Laravel debugbar reports 4 queries to the admin
table.
Is there a way to group them together into only one query?
via Ethan22