Closed fahmifitu closed 4 years ago
See this:
https://github.com/kdion4891/laravel-livewire-tables#sortusingcallback
For some reason that didn't work for me. it returns a SQL syntax error.
After some time of debugging, I figured out that the issue is with query binding.
Although is not safe, I found a workaround concatenating the sort direction like that works just fine even though it is the same query
return $models->orderByRaw('data->\'$.name\' ' . $sort_direction);
You can reproduce the same error with
dd(DB::table('users') ->orderByRaw('created_at ?', ['desc']) ->get());
I haven't put much thought into json columns with this package. If you come up with a decent solution, feel free to submit a PR.
Hello, Great work you put into the package, really simple and useful. I have a quick question, Is there a way of how we can create a column out of json column in a foreign table and make it sortable and searchable?
Thanks