Answer the question
In order to leave comments, you need to log in
How to sort database records by json object in Laravel?
Friends, good afternoon.
Please tell me how to solve the following situation (Laravel framework):
There is a table rows:
id name
And there is a table rows_user_sort:
user_id sort
in the sort field is a json object with row.id and sort - the serial number for sorting:
[{"id" : 244, "sort": 0}, {"id": 4, "sort": 1}, {"id": 20, "sort": 2}, {"id": 21, "sort": 3 }, {"id": 22, "sort": 4}, {"id": 15, "sort": 5}, {"id": 24, "sort": 6}]
How can rows be sorted by similar json object?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question