mirror of
https://github.com/filamentphp/filament.git
synced 2026-10-24 23:35:30 +08:00
Update 03-select.md
This commit is contained in:
@@ -367,28 +367,6 @@ MorphToSelect::make('commentable')
|
||||
])
|
||||
```
|
||||
|
||||
#### Allowing select to be non-native
|
||||
|
||||
You may enable a more customizable JavaScript select using the `native(false)` method:
|
||||
|
||||
```php
|
||||
use Filament\Forms\Components\MorphToSelect;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
MorphToSelect::make('commentable')
|
||||
->native(false)
|
||||
->types([
|
||||
MorphToSelect\Type::make(Product::class)
|
||||
->titleAttribute('name')
|
||||
->modifyOptionsQueryUsing(fn (Builder $query) => $query->whereBelongsTo($this->team)),
|
||||
MorphToSelect\Type::make(Post::class)
|
||||
->titleAttribute('title')
|
||||
->modifyOptionsQueryUsing(fn (Builder $query) => $query->whereBelongsTo($this->team)),
|
||||
])
|
||||
```
|
||||
|
||||
> Many of the same options in the select field are available for `MorphToSelect`, including `searchable()`, `preload()`, `allowHtml()`, and `optionsLimit()`.
|
||||
|
||||
## Allowing HTML in the option labels
|
||||
|
||||
By default, Filament will escape any HTML in the option labels. If you'd like to allow HTML, you can use the `allowHtml()` method:
|
||||
|
||||
Reference in New Issue
Block a user