JustNoOne
1 Select input depends on another Select input's value. Select's options populated by DB table's col
should be something like this
use Filament\Forms\Get;
use App\Models\aaas;
use App\Models\bbbs;
Forms\Components\Select::make('model') ->options([ 'Aaa' => 'Aaa', 'Bbb' => 'Bbb' ]), Forms\Components\Select::make('model_id') ->options([ function (Get $get){ switch ($get('model')){ case 'Aaa': return aaas::all()->pluck('name', 'id'); case 'Bbb': return bbbs::all()->pluck('name', 'id'); default: } } ]),
Forms\Components\Select::make('model') ->options([ 'Aaa' => 'Aaa', 'Bbb' => 'Bbb' ]), Forms\Components\Select::make('model_id') ->options([ function (Get $get){ switch ($get('model')){ case 'Aaa': return aaas::all()->pluck('name', 'id'); case 'Bbb': return bbbs::all()->pluck('name', 'id'); default: } } ]),
7 replies