FormResponse   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A downloadAll() 0 15 1
1
<?php
2
3
namespace App\Models;
4
5
use Excel;
6
use Illuminate\Database\Eloquent\Model;
7
8
class FormResponse extends Model
9
{
10
    protected $guarded = ['id'];
11
12
    public static function downloadAll()
13
    {
14
        Excel::create('Responses '.date('Y-m-d'), function ($excel) {
15
            $excel->sheet('Responses', function ($sheet) {
16
                $sheet->freezeFirstRow();
17
18
                $sheet->cells('A1:Z1', function ($cells) {
19
                    $cells->setFontWeight('bold');
20
                    $cells->setBorder('node', 'none', 'solid', 'none');
21
                });
22
23
                $sheet->fromModel(self::all());
24
            });
25
        })->download('xlsx');
26
    }
27
}
28