Attach Multiple | How does it work?

So after initially looking at this post I thought it would be straight forward: https://filamentphp.com/tricks/allow-multiple-records-in-a-attach-select However this alone is not enough as it only attached the first record selected even after implementing this:
Tables\Actions\AttachAction::make()
->recordSelect(function (Forms\Components\Select $select) {
return $select->multiple();
})
->recordSelectOptionsQuery(fn($query) => $query->where('article_type_id', ArticleTypeEnum::courses->getId()))
->preloadRecordSelect(),
Tables\Actions\AttachAction::make()
->recordSelect(function (Forms\Components\Select $select) {
return $select->multiple();
})
->recordSelectOptionsQuery(fn($query) => $query->where('article_type_id', ArticleTypeEnum::courses->getId()))
->preloadRecordSelect(),
Any advice? The only 'using' method I see is ->using() so not very descriptive.
18 Replies
toeknee
toeknee2y ago
@Dennis Koch if you get a minute, there is also a few comments on the trick page too.
Dennis Koch
Dennis Koch2y ago
I think this trick was submitted by @dennissmink 😅
toeknee
toeknee2y ago
ahhh! I just saw Dennis so think of you firstly
Dennis
Dennis2y ago
Worked fine for me at the time
toeknee
toeknee2y ago
Did you think you could review it now? Might be a bug we need to fix
GavTheDev
GavTheDev2y ago
Same issue here 😕
toeknee
toeknee2y ago
@dennissmink did you happen to get chance to review?
DianaMujoiu
DianaMujoiu2y ago
The issue still persists. Can't add multiple records in attach
sumardi
sumardi2y ago
what version are u running?
DianaMujoiu
DianaMujoiu2y ago
v2
Dan Harrin
Dan Harrin2y ago
which v2 also send code
sumardi
sumardi2y ago
php artisan about
DianaMujoiu
DianaMujoiu2y ago
v2.17.4
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('title'),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
Tables\Actions\AttachAction::make()
->recordSelect(function (Select $select) {
return $select->multiple();
})
->preloadRecordSelect(),
])
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('title'),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
Tables\Actions\AttachAction::make()
->recordSelect(function (Select $select) {
return $select->multiple();
})
->preloadRecordSelect(),
])
sumardi
sumardi2y ago
That’s from february. Just upgrade to the latest version.
DianaMujoiu
DianaMujoiu2y ago
Can I upgrade filament without composer update?
awcodes
awcodes2y ago
You can update specific packages if you’re worried about updating all of them. So you can update just filament.
DianaMujoiu
DianaMujoiu2y ago
I updated all of them and now I have errors like this
Dennis Koch
Dennis Koch2y ago
Probably just Intelephense that hasn't indexed the new code yet
Want results from more Discord servers?
Add your server