Passed
Push — master ( 600b1b...3d64dd )
by Reza
03:22
created

Lists::crudUpdated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace EasyPanel\Http\Livewire\CRUD;
4
5
use EasyPanel\Models\Todo;
6
use Livewire\Component;
7
use Livewire\WithPagination;
8
use EasyPanel\Models\CRUD;
9
use Illuminate\Support\Facades\Artisan;
10
11
class Lists extends Component
12
{
13
    use WithPagination;
14
15
    protected $paginationTheme = 'bootstrap';
16
17
    protected $listeners = ['crudUpdated'];
18
19
    public function crudUpdated()
20
    {
21
        // There is nothing to do, just update It.
22
    }
23
24
    public function buildAll()
25
    {
26
        Artisan::call('panel:crud', [
27
            '--force' => true
28
        ]);
29
30
        CRUD::query()->where('active', true)->update([
31
            'built' => true
32
        ]);
33
34
        $this->dispatchBrowserEvent('show-message', [
35
            'type' => 'success',
36
            'message' => __('CRUD Created successfully')
37
        ]);
38
39
        $this->redirect(route(getRouteName().'.crud.lists'));
40
    }
41
42
    public function render()
43
    {
44
        $cruds = CRUD::query()
45
            ->paginate(20);
46
47
        return view('admin::livewire.crud.lists', compact('cruds'))
48
            ->layout('admin::layouts.app');
49
    }
50
}
51