|
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
|
|
|
|