How to make custom datetime column sortable?
im in my songs table. i want to sort the songs by the last time i played them
i have a pivot table between songs and users, there i store the
so far i have this code:
seems i have to join the tables somehow and then just sort by that field. the problem is that when i join them i get and idk how to solve it. to solve it i tried to select only the columns i needed from the pivot table, so i dont get the created_at field, but i couldnt get to do it:
i also tried it this way but it doesnt work:
i have a pivot table between songs and users, there i store the
played_at field, along with other relevant pivot attributesso far i have this code:
seems i have to join the tables somehow and then just sort by that field. the problem is that when i join them i get and idk how to solve it. to solve it i tried to select only the columns i needed from the pivot table, so i dont get the created_at field, but i couldnt get to do it:
i also tried it this way but it doesnt work: