Skip to content

Add bulk actions (attach, detach, manage) to Spatie Laravel Tags Plugin#20124

Closed
intrepidws wants to merge 11 commits into
filamentphp:4.xfrom
intrepidws:spatie-laravel-tags-bulk-actions
Closed

Add bulk actions (attach, detach, manage) to Spatie Laravel Tags Plugin#20124
intrepidws wants to merge 11 commits into
filamentphp:4.xfrom
intrepidws:spatie-laravel-tags-bulk-actions

Conversation

@intrepidws

Copy link
Copy Markdown
Contributor

Description

This PR adds table bulk actions to the filament/spatie-laravel-tags-plugin package. Until now the plugin shipped a form field (SpatieTagsInput), a table column (SpatieTagsColumn), and an infolist entry (SpatieTagsEntry), but there was no way to tag many records at once. These actions fill that gap, mirroring the behavior and options of the existing SpatieTagsInput.

Three new bulk actions are added:

  • AttachSpatieTagsBulkAction — opens a modal with a tags input and attaches the chosen tags to every selected record. Existing tags on a record are preserved (via syncWithoutDetaching), and tags that don't exist yet are created.
  • DetachSpatieTagsBulkAction — removes the chosen tags from the selected records without deleting the tags themselves from the database.
  • ManageSpatieTagsBulkAction — a single modal with two tags inputs, so users can attach some tags and detach others in one pass. Each record's attach + detach is wrapped in a DB::transaction so a mid-record failure can't leave it half-updated.
use Filament\Actions\AttachSpatieTagsBulkAction;
use Filament\Actions\DetachSpatieTagsBulkAction;
use Filament\Actions\ManageSpatieTagsBulkAction;
use Filament\Tables\Table;

public function table(Table $table): Table
{
    return $table
        ->toolbarActions([
            AttachSpatieTagsBulkAction::make(),
            DetachSpatieTagsBulkAction::make(),
            // ...or, instead of the two above:
            ManageSpatieTagsBulkAction::make(),
        ]);
}

Visual changes

Screenshot 2026-07-08 at 1 45 45 PM Screenshot 2026-07-08 at 1 44 00 PM Screenshot 2026-07-08 at 1 44 11 PM Screenshot 2026-07-08 at 1 44 22 PM

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@danharrin

Copy link
Copy Markdown
Member

Thanks for you work here, I think I am going to pass though. In my opinion customisability is quite important for tagging UIs as tags can be used in a variety of ways, and I think having users define these in their apps is probably not too bad. I would suggest opening discussion threads in the future and tagging me to suggest big features like this as it helps us validate it first before you spend time on the implementation.

@danharrin danharrin closed this Jul 9, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in Roadmap Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants