@wireUiStyles @wireUiScripts

Deletable

3592
enim ipsum recusandae
Mollitia volupta...
09/07/2021

Delete 3592

Are you sure?
3591
quo incidunt velit
Laboriosam animi...
09/07/2021

Delete 3591

Are you sure?
3590
dolore repudiandae voluptas
Veritatis repell...
09/07/2021

Delete 3590

Are you sure?
3589
non et in
Est enim nostrum...
09/07/2021

Delete 3589

Are you sure?
3588
inventore rerum amet
Facilis dolores...
09/07/2021

Delete 3588

Are you sure?
3587
est aperiam est
At ducimus aperi...
09/07/2021

Delete 3587

Are you sure?
3586
sequi rerum rem
Recusandae a ut...
09/07/2021

Delete 3586

Are you sure?
3585
ipsam ex similique
Sed nulla aliqua...
09/07/2021

Delete 3585

Are you sure?
3584
aperiam dolorum facilis
Consectetur quas...
09/07/2021

Delete 3584

Are you sure?
3583
sunt assumenda non
Quisquam eligend...
09/07/2021

Delete 3583

Are you sure?
Previous
Results 1 - 10 of 3592
<livewire:deletable-demo-table />

<livewire:restore-all model="App\Post" />
<?php

namespace App\Http\Livewire;

use App\Post;
use Mediconesystems\LivewireDatatables\Column;
use Mediconesystems\LivewireDatatables\DateColumn;
use Mediconesystems\LivewireDatatables\NumberColumn;
use Mediconesystems\LivewireDatatables\Http\Livewire\LivewireDatatable;

class DeletableDemoTable extends LivewireDatatable
{
    public $model = Post::class;

    public function columns()
    {
        return [
            NumberColumn::name('id')->filterable(),
            Column::name('title')->filterable()->searchable(),
            Column::name('body')->truncate()->filterable()->searchable(),
            DateColumn::name('created_at')->filterable(),
            Column::delete()->label('delete')->alignRight()
        ];
    }
}
<?php

namespace App\Http\Livewire;

use Livewire\Component;

class RestoreAll extends Component
{
    public $model;

    public function mount($model)
    {
        $this->model = $model;
    }

    public function restoreAll()
    {
        $this->model::onlyTrashed()->get()->each->restore();
        $this->emit('refreshLivewireDatatable');
    }

    public function render()
    {
        return <<<'blade'
            <div class="flex justify-center">
                <button wire:click="restoreAll" class="px-3 py-2 bg-orange-600 text-white rounded hover:bg-orange-800 focus:outline-none">Restore All</button>
            </div>
        blade;
    }
}