DefaultImporterHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Importers;
6
7
use Maatwebsite\Excel\Files\ExcelFile;
8
use Maatwebsite\Excel\Collections\CellCollection;
9
10
class DefaultImporterHandler
11
{
12
    public function handle(ExcelFile $importer)
13
    {
14
        $importer->each(function (CellCollection $row) use ($importer) {
15
            app('cortex.foundation.import_record')->create([
16
                'resource' => app($importer->config['resource'])->getMorphClass(),
17
                'data' => $row,
18
            ]);
19
        });
20
    }
21
}
22