Completed
Push — master ( a4261d...fc5e52 )
by John
14s
created

AccountExport::array()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace App\Exports;
4
5
use Maatwebsite\Excel\Concerns\FromArray;
6
use Maatwebsite\Excel\Concerns\WithHeadings;
7
8
class AccountExport implements FromArray, WithHeadings
9
{
10
    protected $data;
11
12
    public function __construct(array $data)
13
    {
14
        $this->data = $data;
15
    }
16
17
    public function array(): array
18
    {
19
        return $this->data;
20
    }
21
22
    public function headings(): array
23
    {
24
        return [
25
            'uid',
26
            'name',
27
            'email',
28
            'password',
29
        ];
30
    }
31
32
    //Export:
33
    //Excel::download(new AccountExport($exportData), $filename.'.xlsx');
34
    //Store:
35
    //Excel::store(new AccountExport, $filename.'.xlsx', $custom_disk);
36
}
37