LocationsSeeder::run()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 10
rs 9.4285
c 1
b 0
f 1
ccs 0
cts 10
cp 0
cc 1
eloc 8
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Scool\Timetables\Database\Seeds;
4
5
use Scool\Timetables\Models\Location;
6
use Illuminate\Database\Seeder;
7
8
/**
9
 * Class LocationsSeeder
10
 * @package Scool\Timetables\Database\Seeds
11
 */
12
class LocationsSeeder extends Seeder
13
{
14
    /**
15
     * Run the database seeds.
16
     *
17
     * @return void
18
     */
19
    public function run()
20
    {
21
        $this->createLocation('20.2', 'Aula 20.2');
22
        $this->createLocation('20.3', 'Aula 20.3');
23
        $this->createLocation('20.4', 'Aula 20.4');
24
        $this->createLocation('21', 'Aula 21');
25
        $this->createLocation('22', 'Aula 22');
26
        $this->createLocation('23', 'Aula 23');
27
        $this->createLocation('Actes', 'Sala d\'actes');
28
    }
29
30
    /**
31
     * @param $name
32
     * @param $code
33
     * @param $lective
34
     */
35
    private function createLocation($name, $description)
36
    {
37
        Location::firstOrCreate([
38
            'name' => $name,
39
            'description' => $description
40
        ]);
41
    }
42
}
43