DatatableStateTrait::getIndexDatatable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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
}