-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Description
In last version of laravel
im using two models:
- contact
- document, which belongsTo contact by contact_id field
For order by relation field (for example last_name)
im using (may be isnt correct , but not anything about it in documentation)
$documents = Document::with('contact')->join('contacts', 'contacts.id', '=', 'documents.id')->orderBy('contacts.name')->get()
after that query in loop
foreach($documents AS $document){
if($document->id == $document->contact->id){
// always matched here! but in database its not like that
}
}
if i remove join() - all correct,
please this is a bug or feature and advice about orderBy relation fields.
Thanks
eli-s-r, gmhafiz and jordanade
Metadata
Metadata
Assignees
Labels
No labels