Completed
Pull Request — master (#201)
by
unknown
02:10
created

ExcelExport::isHiddenColumnsExported()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nayjest\Grids\Components;
4
5
use App\Jobs\ExportExcel;
6
use Event;
7
use Nayjest\Grids\Components\Base\RenderableComponent;
8
use Nayjest\Grids\Grid;
9
10
class ExcelExport extends RenderableComponent
11
{
12
    private $baseName;
13
    private $date;
14
    private $config;
15
16
    const NAME = 'excel_export';
17
    protected $template = '*.components.excel_export';
18
19
    const INPUT_PARAM = 'xlsx';
20
21
    /**
22
     * @return mixed
23
     */
24
    public function getDate()
25
    {
26
        return $this->date;
27
    }
28
29
    /**
30
     * @return mixed
31
     */
32
    public function getBaseName()
33
    {
34
        return $this->baseName;
35
    }
36
37
    /**
38
     * @param mixed $baseName
39
     */
40
    public function setBaseName($baseName)
41
    {
42
        $this->baseName = $baseName;
43
        return $this;
44
    }
45
46
    /**
47
     * @param mixed $date
48
     */
49
    public function setDate($date)
50
    {
51
        $this->date = $date;
52
        return $this;
53
    }
54
55
    public function initialize(Grid $grid)
56
    {
57
        parent::initialize($grid);
58
        Event::listen(Grid::EVENT_PREPARE, function (Grid $grid) {
59
        $this->config = $grid->getConfig();
60
            if ($grid->getInputProcessor()->getValue(static::INPUT_PARAM, false)) {
61
                dispatch(new ExportExcel($this->getDate(), $this->getBaseName(), $this->config));
62
            }
63
        });
64
    }
65
}