Home API Tools Posts Hire Me About
Sign In Create Account
Laravel

Livewire Bulk Actions Pattern

January 16, 2026 1 min read 29 views

Bulk actions pattern:

Component

public array $selected = [];
public bool $selectAll = false;

public function updatedSelectAll($value)
{
    $this->selected = $value 
        ? $this->users->pluck('id')->toArray() 
        : [];
}

public function deleteSelected()
{
    User::whereIn('id', $this->selected)->delete();
    $this->selected = [];
}

View



@foreach($users as $user)
    
@endforeach

Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!