DatatableStateTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 2
b 0
f 0
dl 0
loc 34
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDatatable() 0 6 1
A getIndexDatatable() 0 11 1
1
<?php namespace Distilleries\Expendable\States;
2
3
trait DatatableStateTrait {
4
5
    /**
6
     * @var \Distilleries\DatatableBuilder\EloquentDatatable $datatable
7
     * Injected by the constructor
8
     */
9
    protected $datatable;
10
11
12
    // ------------------------------------------------------------------------------------------------
13
    // ------------------------------------------------------------------------------------------------
14
    // ------------------------------------------------------------------------------------------------
15
16 8
    public function getIndexDatatable()
17
    {
18 8
        $this->datatable->build();
19 8
        $datatable = $this->datatable->generateHtmlRender();
20 8
        $this->layoutManager->add([
21 8
            'content'=>view('expendable::admin.form.state.datatable')->with([
22 8
                'datatable' => $datatable
23
            ])
24
        ]);
25
26 8
        return $this->layoutManager->render();
27
    }
28
29
    // ------------------------------------------------------------------------------------------------
30
31 6
    public function getDatatable()
32
    {
33 6
        $this->datatable->setModel($this->model);
34 6
        $this->datatable->build();
35
36 6
        return $this->datatable->generateColomns();
37
    }
38
}