How to get name instead of id in a select with relationship

Scenario: Select dependent that should be disabled based on the name of the other.

Forms\Components\Select::make('foo_id')
    ->live()
    ->relationship(name: 'foo', titleAttribute: 'name')
    ->required(),

Forms\Components\Select::make('bar_id')
    ->disabled(fn (Forms\Get $get): bool => ???? )),
`

Is it possible to retrieve the name chosen in the first select component instead of the ID?

I know I can do get the record on DB based on Id and then get the namesomething like that based on id, but at first it seems like this information is already available on the first select, so I want to save this query to retrieve the name.
Was this page helpful?