Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eloquent orderBy not working. #18

Closed
austenpayan opened this issue Feb 11, 2015 · 4 comments
Closed

Eloquent orderBy not working. #18

austenpayan opened this issue Feb 11, 2015 · 4 comments

Comments

@austenpayan
Copy link

Am I just missing something or is orderBy not supported by corcel?

I am trying to arrange some custom post types from oldest to newest, but the normal eloquent orderBy seems to have no effect on the order of the outputted posts.

@threesquared
Copy link

The orderBy seems to be set in the Post model on line 102. I would suggest this is unnecessary and breaks if you want to order by anything else.

@threesquared
Copy link

For a super hacky temp fix you can get the Query object and just unset the order:

$posts = Post::published();
$query = $posts->getQuery();
unset($query->orders[0]);
$posts->setQuery($query);
$posts = $posts->orderBy('post_date', 'asc')->get();

@rundef
Copy link
Member

rundef commented Oct 10, 2015

Also, you might want to have a look at the dev branch... it has already been fixed there

@jgrossi
Copy link
Member

jgrossi commented Oct 13, 2015

Hey guys! Thanks for the support. We're fixing these bugs and it will be merged soon to the master branch. Wait for good news for Corcel :-)

@jgrossi jgrossi closed this as completed Feb 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants