1 | <?php |
||
14 | class RenewTraining extends Command |
||
15 | { |
||
16 | /** |
||
17 | * The number of days to renew a training before it expires. |
||
18 | * |
||
19 | * @var int |
||
20 | */ |
||
21 | protected $offset = 30; |
||
22 | |||
23 | /** |
||
24 | * List of all renewed notes. |
||
25 | * |
||
26 | * @var Collection |
||
27 | */ |
||
28 | protected $trainingAdminRecord; |
||
29 | |||
30 | /** |
||
31 | * The name and signature of the console command. |
||
32 | * |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $signature = 'training:renew'; |
||
36 | |||
37 | /** |
||
38 | * The console command description. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $description = 'Renews training before it expires.'; |
||
43 | |||
44 | /** |
||
45 | * Create a new command instance. |
||
46 | */ |
||
47 | 17 | public function __construct() |
|
52 | |||
53 | /** |
||
54 | * Execute the console command. |
||
55 | * |
||
56 | * @return RenewTraining |
||
57 | */ |
||
58 | 15 | public function handle() |
|
79 | |||
80 | 15 | public function getList() |
|
84 | |||
85 | /** |
||
86 | * Check if training note has been renewed already. |
||
87 | * |
||
88 | * @param $trainingUser |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | 13 | private function renewedAlready($trainingUser) |
|
106 | |||
107 | /** |
||
108 | * Check if the training is past the renews_in value. |
||
109 | * |
||
110 | * @param $trainingUser |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | 7 | private function timeToRenew($trainingUser) |
|
131 | |||
132 | /** |
||
133 | * Generate a new Training note that will be due $this->offset days from now. |
||
134 | * |
||
135 | * @param $trainingUser |
||
136 | */ |
||
137 | 5 | private function processRenewal($trainingUser) |
|
161 | |||
162 | /** |
||
163 | * @param $trainingUser |
||
164 | * @param Carbon $dueDate |
||
165 | * |
||
166 | * @return TrainingUser |
||
167 | */ |
||
168 | 5 | private function createRecord($trainingUser, $dueDate) |
|
180 | } |
||
181 |