Basically my database model does not have a name column, which is fine because I can just use optionsLabel function to specify keyword as the column that's to be used for the option titles.
Works great.
Now if I wanted sort ^ that list alphabetically, I should be able to do that by overriding the relatableQuery method on my Keyword model like this:
I don't have a name column, and even if I did, I would rather determine sort logic myself via relatableQuery as explained above. So the sorting just breaks because of this.
This should be a super easy issue to fix.
Basically my database model does not have a
name
column, which is fine because I can just useoptionsLabel
function to specifykeyword
as the column that's to be used for the option titles.Works great.
Now if I wanted sort ^ that list alphabetically, I should be able to do that by overriding the
relatableQuery
method on my Keyword model like this:The problem is that the sort order gets completely overwritten by this piece of logic inside ResourceController.php here: https://github.com/Benjacho/belongs-to-many-field-nova/blob/master/src/Http/Controllers/ResourceController.php#L35
I don't have a
name
column, and even if I did, I would rather determine sort logic myself viarelatableQuery
as explained above. So the sorting just breaks because of this.Two potential solutions here:
sortBy('name')
altogethersortBy($optionsLabel)
I decided to go with option 1.