To add serveral column in sort sentence we should  add them in reverse order.

For example if we want to sort countries by continent_name and after that by name, it should look like in sql query like  … SORT BY continent_name ASC, name ASC

With Eloquent sort arguments should be added in reverse order: Country::all()->sortBy(‘name’)->sortBy(‘continent_name’);

I lost some time on that and decided to add it to post.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.