© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
8 replies
eliaszobody

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
gameday
gameday
, which is basically just a date (e.g.
2023-08-24
2023-08-24
), but I wish to modify the option labels to make it more readable (e.g.
Sunday, Aug 13, 2024
Sunday, Aug 13, 2024
. I attempted this:
AttachAction::make()->recordSelect(
  fn (Select $select) => $select->getOptionLabelFromRecordUsing(
    fn (Model $record) => modify($record->date)
  )
)
AttachAction::make()->recordSelect(
  fn (Select $select) => $select->getOptionLabelFromRecordUsing(
    fn (Model $record) => modify($record->date)
  )
)

But the labels didn't change at all. I even tried a
dd($record->date)
dd($record->date)
inside of the
getOptionLabelFromRecordUsing()
getOptionLabelFromRecordUsing()
callback, but nothing died or dumped. So it appears that the method isn't being called at all. Certain methods (e.g.
multiple()
multiple()
) worked as intended when called on the select, but others (e.g.
getOptionLabelUsing(//)
getOptionLabelUsing(//)
or
getOptionLabelFromRecordUsing(//)
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 ...

  Tables\Actions\AttachAction::make()
      ->recordTitle(function ($record) {
          return $record->your_date->format('%x %y %x');
      })
  Tables\Actions\AttachAction::make()
      ->recordTitle(function ($record) {
          return $record->your_date->format('%x %y %x');
      })


Assuming the attribute is cast to a date. Obviously modify the format to suit.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Modify Label Options in RelationManager attach action
FilamentFFilament / ❓┊help
2y ago
Modify label in select options
FilamentFFilament / ❓┊help
3y ago
Dependent select in attach action
FilamentFFilament / ❓┊help
3y ago
format options on relationship manager select in attach form
FilamentFFilament / ❓┊help
3y ago