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

AccountExport   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
dl 0
loc 21
rs 10
c 1
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A array() 0 3 1
A headings() 0 7 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