1 | <?php |
||
15 | class Lesson extends Model implements Transformable, Stateful |
||
16 | { |
||
17 | use TransformableTrait, StatefulTrait; |
||
18 | |||
19 | protected $fillable = ['id','location_id','day_id','timeslot_id','classroom_id', 'state']; |
||
20 | |||
21 | /** |
||
22 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
23 | */ |
||
24 | public function locations() |
||
28 | |||
29 | /** |
||
30 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
31 | */ |
||
32 | public function days() |
||
36 | |||
37 | /** |
||
38 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
39 | */ |
||
40 | public function timeslots() |
||
44 | |||
45 | /** |
||
46 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
47 | */ |
||
48 | public function classrooms() |
||
52 | |||
53 | /** |
||
54 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
55 | */ |
||
56 | public function users() |
||
60 | |||
61 | /** |
||
62 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
63 | */ |
||
64 | public function submodules() |
||
68 | |||
69 | /** |
||
70 | * States. |
||
71 | * |
||
72 | * @var array |
||
73 | */ |
||
74 | protected $states = [ |
||
75 | 'step1' => ['initial' => true], |
||
76 | 'step2' => ['final' => true] |
||
77 | ]; |
||
78 | /** |
||
79 | * Transaction State Transitions |
||
80 | * |
||
81 | * @var array |
||
82 | */ |
||
83 | protected $transitions = [ |
||
84 | 'step1step2' => [ |
||
85 | 'from' => 'step1', |
||
86 | 'to' => 'step2' |
||
87 | ], |
||
88 | 'step2step1' => [ |
||
89 | 'from' => 'step2', |
||
90 | 'to' => 'step1' |
||
91 | ] |
||
92 | ]; |
||
93 | /** |
||
94 | * @return bool |
||
95 | */ |
||
96 | protected function validateStep1step2() |
||
101 | /** |
||
102 | * @return bool |
||
103 | */ |
||
104 | protected function validateStep2step1() |
||
108 | |||
109 | } |
||
110 |