V
V
Vasyl Fomin2018-03-24 13:56:41
Laravel
Vasyl Fomin, 2018-03-24 13:56:41

How to sort books by first author in Elequent?

Hello. It is not possible to write a qlequent query to sort books by the first (first) author (one-to-many relationship - the book has many authors). I use WhereHas, but something doesn't work...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
miki131, 2018-07-25
@miki131

It seems to me the request will turn out to be too complicated.
It is better for you to add a column in the table of books where to write down the first author.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question