DatatableStateTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getIndexDatatable() 0 7 1
A getDatatable() 0 6 1
1
<?php
2
3
namespace Distilleries\DatatableBuilder\States;
4
5
trait DatatableStateTrait
6
{
7
    /**
8
     * Datatable (injected by the constructor).
9
     *
10
     * @var \Distilleries\DatatableBuilder\EloquentDatatable $datatable
11
     */
12
    protected $datatable;
13
14
    /**
15
     * Model (injected by the contructor).
16
     *
17
     * @var \Illuminate\Database\Eloquent\Model $model
18
     */
19
    protected $model;
20
21
    /**
22
     * View to display datatable.
23
     *
24
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
25
     */
26 4
    public function getIndexDatatable()
27
    {
28 4
        $this->datatable->build();
29 4
        $datatable = $this->datatable->generateHtmlRender();
30
31 4
        return view('datatable-builder::form.state.datatable')->with([
32 4
            'datatable' => $datatable,
33
        ]);
34
    }
35
36
    /**
37
     * Return generated datatable.
38
     *
39
     * @return mixed
40
     */
41 2
    public function getDatatable()
42
    {
43 2
        $this->datatable->setModel($this->model);
44 2
        $this->datatable->build();
45
46 2
        return $this->datatable->generateColomns();
47
    }
48
}
49