© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
6 replies
Xavi

TagsInput belongsToMany

How can i set the TagsInput value on edit form, if values are a belongsToMany relationship

i try something like this, but it doesn't works


->loadStateFromRelationshipsUsing(function ($record) {
    return $record->keywords()->where('manual', true)->pluck('name')->toArray();
})
->loadStateFromRelationshipsUsing(function ($record) {
    return $record->keywords()->where('manual', true)->pluck('name')->toArray();
})


Thanks
Solution
i found solution with

->mutateRecordDataUsing(function (array $data, $record): array {
    $data['keywords'] = $record->keywords()->where('manual', true)->pluck('name')->toArray();
    return $data;
})
->mutateRecordDataUsing(function (array $data, $record): array {
    $data['keywords'] = $record->keywords()->where('manual', true)->pluck('name')->toArray();
    return $data;
})

on EditAction.

Thanks!
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

TagsInput Validation
FilamentFFilament / ❓┊help
3y ago
TagsInput Copy/Paste
FilamentFFilament / ❓┊help
16mo ago
TagsInput not displaying
FilamentFFilament / ❓┊help
3y ago
TagsInput : Suggestions list
FilamentFFilament / ❓┊help
3y ago