How to modify options label on the attach action select.
Hey, I'm building this app in which within a Relation Manager I want to attach a
But the labels didn't change at all. I even tried a
Am I going about this the wrong way? Is there a better way to do this? Is there an error in my code? Or did I stumble across a bug?
gameday, which is basically just a date (e.g. 2023-08-24), but I wish to modify the option labels to make it more readable (e.g. Sunday, Aug 13, 2024. I attempted this:But the labels didn't change at all. I even tried a
dd($record->date) inside of the getOptionLabelFromRecordUsing() callback, but nothing died or dumped. So it appears that the method isn't being called at all. Certain methods (e.g. multiple()) worked as intended when called on the select, but others (e.g. getOptionLabelUsing(//) or getOptionLabelFromRecordUsing(//) didn't seem to have any effect. Am I going about this the wrong way? Is there a better way to do this? Is there an error in my code? Or did I stumble across a bug?
Solution
Maybe I'm misunderstanding what you are trying to do, but if you want to change the option labels on the attach dropdown, it'd be ...
Assuming the attribute is cast to a date. Obviously modify the format to suit.
Assuming the attribute is cast to a date. Obviously modify the format to suit.