Level 122
I think a join of the child model is the only way to go
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have the following relationship in my modal agentBilling:
public function batches(){
return $this->hasMany(agent_billings_batches::class,'agentBillingPeriod','id');
}
And in the agent_billings_batches model, I've got the following relationship:
public function date(){
return $this->hasOne(agent_billings_dates::class,'id','dateID');
}
The agent_billings_dates model has a date fields labeled simply date. Is there a way I could sort the batches relationship in the agentBilling model by the date field in the date relationship of the agent_billings_batches? Or is there a way around this?
Thanks! Matt
Please or to participate in this conversation.