I just followed this todo list tutorial and I have a few questions.
I would like to sort the objects by a key in Laravel and I just cannot figure this out. Where should I implement this? In Eloquent? In routes? In controllers? Slightly confused about this. I have found a few links going over the sort method using the usort wrapper but I have been unable to implement an object sort (todo list item by a key) successfully.
Would it be more efficient to SQL sort the items? Using something like this:
$sql = "SELECT * FROM `items` ORDER BY `items`.`time` ASC LIMIT 0, 30 ";
Where would I implement this? I feel like the logical place is in my item model. But I'm not sure.
I can post any relevant code, I am just not sure what to post yet, so feel free to ask. And I don't want to spam this post with unnecessary code.