Live select field not found with $get

In a create form, I have a select field called base_position_id defined as
 Select::make('base_position_id')
   ->label('Position')
   ->placeholder('Select a Base Position from DGP')
   ->options(function () {
       return BasePosition::all()->sortBy('jobTitle')->pluck('jobTitle', 'id')
           ->filter(fn($value, $key) => Position::where('base_position_id', $key)
               ->get()
               ->isEmpty());
   })
   ->required()
   ->live(),

Right below that, I have this inside a Split and a Section:
 Placeholder::make('code')
     ->label('Position Code:')
     ->inlineLabel()
     ->content(fn(Get $get) => $get('base_position_id') ?: '')
     ->disabled(),

which works perfectly. So I know base_position_id is getting set correctly and should be available.

But a little farther down I have another select field that I'd like to filter based on base_position_id.
Grid::make()
   ->relationship('alt_manager_code')
   ->columns(1)
   ->schema([
      Select::make('managerCode')
          ->label('Override Hiring Manager')
          ->placeholder('Select Position to Override Manager')
          ->options(function (Get $get) {
              info($get('base_position_id'));  // LOG TO SEE IF VALUE IS AVAILABLE
              return BasePosition::all()
                  ->sortBy('jobTitle')
                  ->pluck('jobTitle', 'id');
          }),
  ]),

Obviously on first load, the logged value is empty. But when I select a base_position_id and the field refreshes, it still logs a blank value. Shouldn't I be getting the selected value at that point? I need it to add a filter to the return collection.
Solution
sorry, i miss-read where the relationship was. try $get('../base_position_id') since you are in a layout component you need to traverse out of it to get the state from other fields.
Was this page helpful?