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

Sort by computed field #70

katieben opened this Issue Apr 4, 2019 · 2 comments


None yet
2 participants
Copy link

katieben commented Apr 4, 2019

Package idea: I'd love to be able to sort by computed field. Right now I'm just adding the field as a regular field, and periodically double-checking it (ew :). Anyone have a smarter idea?

@mattstauffer mattstauffer changed the title Sort by computed field [please tag: package idea] Sort by computed field Apr 4, 2019


This comment has been minimized.

Copy link

mattstauffer commented Apr 4, 2019


So, there are SOME things you can do, as you can see in that issue above. But one of the authors of Nova, David Hemphill, also said it's going to be tough to do it without breaking pagination--probably because it's using MySQL-based sort and you can't do that with a PHP-computed property.

With your periodically double-checking option, if you get stuck there and no one can solve this particular issue, one option (and maybe this is what you mean with periodical double-check it) is to set a trigger--either a cron job, or every time an event happens that would impact the computation of this field--that then makes Laravel calculate it and save it to the regular computed field. Like a projection.

Not sure where that lines up with your specific use case. Like I mentioned in the previous issue, I hope we can solve this because I've definitely run into it before!


This comment has been minimized.

Copy link

katieben commented Apr 4, 2019

Yep, that's what I mean. It would be nice to have the option to sort via Vue, for the models that's appropriate for. Then it would be doable! I don't have a good sense of how much data js can deal with, but I've done it by hand (not Nova) for projects with the amount of data in my use case, and it's a perfect solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.