roombroom
roombroom
FFilament
Created by roombroom on 8/15/2023 in #❓┊help
Using echo listeners
Bump
3 replies
FFilament
Created by roombroom on 6/25/2023 in #❓┊help
Unique selections on relationship repeater
This is the solution I came up with -- It's "messy" but it works for my purposes:
Forms\Components\Repeater::make('itemCategories')
->relationship()
->schema([
Forms\Components\Select::make('category_id')
->label('Category')
->options(function ($state, Closure $get) {
$selectedCategories = array_unique(array_column($get('../../itemCategories'), 'category_id'));
$selectedCategories = array_map(fn($a): int => intval($a), $selectedCategories);
$selectedCategories = array_filter($selectedCategories, function ($a) use ($state) {
return !($a === 0 || $a == $state);
});
return Category::query()->whereNotIn('id', $selectedCategories)->pluck('name', 'id');
})
->required()
->reactive(),
])
Forms\Components\Repeater::make('itemCategories')
->relationship()
->schema([
Forms\Components\Select::make('category_id')
->label('Category')
->options(function ($state, Closure $get) {
$selectedCategories = array_unique(array_column($get('../../itemCategories'), 'category_id'));
$selectedCategories = array_map(fn($a): int => intval($a), $selectedCategories);
$selectedCategories = array_filter($selectedCategories, function ($a) use ($state) {
return !($a === 0 || $a == $state);
});
return Category::query()->whereNotIn('id', $selectedCategories)->pluck('name', 'id');
})
->required()
->reactive(),
])
4 replies
FFilament
Created by roombroom on 6/25/2023 in #❓┊help
Unique selections on relationship repeater
That does appear to be a tutorial for what I'm looking for; ugh, paywalls :/
4 replies