@wireUiStyles @wireUiScripts

Deletable

3582
architecto ea et
Similique asperi...
09/07/2021

Delete 3582

Are you sure?
3581
eos minima eius
Ullam deleniti n...
09/07/2021

Delete 3581

Are you sure?
3580
nisi quia dolor
Nam omnis tenetu...
09/07/2021

Delete 3580

Are you sure?
3579
rem sunt explicabo
Aut recusandae q...
09/07/2021

Delete 3579

Are you sure?
3578
reprehenderit aut quod
Exercitationem e...
09/07/2021

Delete 3578

Are you sure?
3577
eius eaque tempore
Commodi debitis...
09/07/2021

Delete 3577

Are you sure?
3576
consequuntur accusamus dolor
Itaque et amet d...
09/07/2021

Delete 3576

Are you sure?
3575
doloribus laborum distinctio
A officia sed qu...
09/07/2021

Delete 3575

Are you sure?
3574
sit recusandae saepe
Voluptas commodi...
09/07/2021

Delete 3574

Are you sure?
3573
iusto qui ipsa
Modi minima quae...
09/07/2021

Delete 3573

Are you sure?
Results 11 - 20 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;
    }
}