Forms\Components\Select::make('relation_address_id')->label('Kies een adres')
->relationship('relationAddress', 'name')
->disabled(fn (Forms\Get $get) => $get('relation_id') == null)
->required()
->options(function(callable $get) {
$relation = Relation::find($get('relation_id'));
if (!$relation) {
return [];
}
return $relation->addresses()->pluck('name', 'id');
})
->createOptionForm(__The code above__)
);
Forms\Components\Select::make('relation_address_id')->label('Kies een adres')
->relationship('relationAddress', 'name')
->disabled(fn (Forms\Get $get) => $get('relation_id') == null)
->required()
->options(function(callable $get) {
$relation = Relation::find($get('relation_id'));
if (!$relation) {
return [];
}
return $relation->addresses()->pluck('name', 'id');
})
->createOptionForm(__The code above__)
);