ContactsImport   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A collection() 0 10 2
1
<?php
2
3
namespace Adminetic\Contact\Imports;
4
5
use Illuminate\Support\Collection;
6
use Adminetic\Contact\Models\Admin\Contact;
7
use Maatwebsite\Excel\Concerns\ToCollection;
8
use Maatwebsite\Excel\Concerns\WithHeadingRow;
9
10
class ContactsImport implements ToCollection, WithHeadingRow
11
{
12
    /**
13
     * @param Collection $collection
14
     */
15
    public function collection(Collection $collection)
16
    {
17
        foreach ($collection as $row) {
18
            Contact::create([
19
                'name' => $row['name'],
20
                'email' => $row['email'],
21
                'phone' => $row['phone'],
22
                'address' => $row['address'],
23
                'favorite' => $row['favorite'],
24
                'active' => $row['active']
25
            ]);
26
        }
27
    }
28
}
29