W
W
WebDev2016-04-13 22:18:23
Laravel
WebDev, 2016-04-13 22:18:23

Laravel sort by related table?

Is it possible to sort by related table?

#
Post::with('journal')->get();

You need to add sorting by journal.name

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Kravchishin, 2016-04-13
@kirill-93

If you need to sort the results by the fields of another table, you need to do a JOIN. Any "connection" is a new selection from the base.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question