Completed
Push — master ( da79e9...169abe )
by David Martínez
02:19
created

DaysSeeder::createDay()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
rs 9.4285
c 1
b 0
f 0
ccs 0
cts 8
cp 0
cc 1
eloc 5
nc 1
nop 3
crap 2
1
<?php
2
3
namespace Scool\Timetables\Database\Seeds;
4
5
use Illuminate\Database\Seeder;
6
use Scool\Timetables\Models\Day;
7
8
/**
9
 * Class DaysSeeder
10
 * @package Scool\Timetables\Database\Seeds
11
 */
12
class DaysSeeder extends Seeder
13
{
14
    /**
15
     * Run the database seeds.
16
     *
17
     * @return void
18
     */
19
    public function run()
20
    {
21
        //TODO Just trying - read wikia to do it right
22
        $this->createDay('Dilluns',1,true);
23
        $this->createDay('Dimarts',2,true);
24
        $this->createDay('Dimecres',3,true);
25
        $this->createDay('Dijous',4,true);
26
        $this->createDay('Divendres',5,true);
27
        $this->createDay('Dissabte',6,false);
28
        $this->createDay('Diumenge',7,false);
29
30
    }
31
32
    /**
33
     * @param $name
34
     * @param $code
35
     * @param $lective
36
     */
37
    private function createDay($name, $code, $lective)
38
    {
39
        Day::firstOrCreate([
0 ignored issues
show
Bug introduced by
The method firstOrCreate() does not exist on Scool\Timetables\Models\Day. Did you maybe mean create()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
40
            'name' => $name,
41
            'code' => $code,
42
            'lective' => $lective
43
        ]);
44
    }
45
}
46