Deletable

2506
optio assumenda et
Ut in repudianda...
15/10/2020

Delete 2506

Are you sure?
2505
id assumenda dolor
Aut rerum volupt...
15/10/2020

Delete 2505

Are you sure?
2504
aut optio nihil
Velit quia solut...
15/10/2020

Delete 2504

Are you sure?
2503
sunt est placeat
Voluptas delectu...
15/10/2020

Delete 2503

Are you sure?
2502
ea aut quisquam
Eaque eligendi a...
15/10/2020

Delete 2502

Are you sure?
2501
modi impedit quo
Dignissimos quos...
15/10/2020

Delete 2501

Are you sure?
2500
saepe voluptatum ab
Odio qui distinc...
15/10/2020

Delete 2500

Are you sure?
2499
est autem suscipit
Sequi et eum mol...
15/10/2020

Delete 2499

Are you sure?
2498
facilis ut molestias
Vel neque dolor...
15/10/2020

Delete 2498

Are you sure?
2497
dolorem porro consequuntur
Dignissimos maio...
15/10/2020

Delete 2497

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