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

DaysSeeder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 34
rs 10
c 1
b 0
f 0
ccs 0
cts 18
cp 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 12 1
A createDay() 0 8 1
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