Completed
Push — master ( 57b9da...49faca )
by David Martínez
02:06
created

TimeslotsSeeder::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 15
cp 0
cc 1
eloc 13
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Scool\Timetables\Database\Seeds;
4
5
use Illuminate\Database\Seeder;
6
use Scool\Timetables\Models\Timeslot;
7
8
9
/**
10
 * Class TimeslotsSeeder
11
 * @package Scool\Timetables\Database\Seeds
12
 */
13
class TimeslotsSeeder extends Seeder
14
{
15
    /**
16
     * Run the database seeds.
17
     *
18
     * @return void
19
     */
20
    public function run()
21
    {
22
        $this->createTimeslot('Primera',"08:00","09:00");
23
        $this->createTimeslot('Segona',"09:00","10:00");
24
        $this->createTimeslot('Tercera',"10:00","11:00");
25
        $this->createTimeslot('Quarta',"11:30","12:30");
26
        $this->createTimeslot('Cinquena',"12:30","13:30");
27
        $this->createTimeslot('Sisena',"13:30","14:30");
28
        $this->createTimeslot('Setena',"15:30","16:30");
29
        $this->createTimeslot('Vuitena',"16:30","17:30");
30
        $this->createTimeslot('Novena',"17:30","18:30");
31
        $this->createTimeslot('Desena',"19:00","20:00");
32
        $this->createTimeslot('Onzena',"20:00","21:00");
33
        $this->createTimeslot('Dotzena',"21:00","22:00");
34
35
    }
36
37
    /**
38
     * @param $name
39
     * @param $code
40
     * @param $lective
41
     */
42
    private function createTimeslot($name, $init_hour, $final_hour)
43
    {
44
        Timeslot::firstOrCreate([
45
            'name' => $name,
46
            'init_hour' => $init_hour,
47
            'final_hour' => $final_hour
48
        ]);
49
    }
50
}
51