I'm building a filter functionality (which already works). Now I just want to add an order functionality to it: Order by "artist name", "artwork title",...
The possible order values aren't "fields" in this table. I can't find a way to start this "orderBy" query. What I'm looking for is something like this:
$artworks = $artworks->orderBy(function($q) use($request){
$q->where('title', 'LIKE', '%artist_name%');
});
But obviously this doesn't work. Is there a way to do this?
For example: I want to be able to sort on artworks that have a title
"artist_name", ordered by the value
of those records
I have two tables: Artworks
& Artwork_data
(one to many relationship).
This is my Artwork_data
table: