1 | <?php |
||
28 | class DemoSeederCommand extends Command |
||
29 | { |
||
30 | use ConfirmableTrait; |
||
31 | |||
32 | /** |
||
33 | * The console command name. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $name = 'gitamin:seed'; |
||
38 | |||
39 | /** |
||
40 | * The console command description. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $description = 'Seeds Gitamin with demo data.'; |
||
45 | |||
46 | /** |
||
47 | * Execute the console command. |
||
48 | * |
||
49 | * @return void |
||
50 | */ |
||
51 | public function fire() |
||
67 | |||
68 | /** |
||
69 | * Seed the project teams table. |
||
70 | * |
||
71 | * @return void |
||
72 | */ |
||
73 | protected function seedOwners() |
||
90 | |||
91 | /** |
||
92 | * Seed the projects table. |
||
93 | * |
||
94 | * @return void |
||
95 | */ |
||
96 | protected function seedProjects() |
||
132 | |||
133 | /** |
||
134 | * Seed the issues table. |
||
135 | * |
||
136 | * @return void |
||
137 | */ |
||
138 | protected function seedIssues() |
||
179 | |||
180 | /** |
||
181 | * Seed the comments table. |
||
182 | * |
||
183 | * @return void |
||
184 | */ |
||
185 | protected function seedComments() |
||
186 | { |
||
187 | $defaultComments = [ |
||
188 | [ |
||
189 | 'message' => ':+1: We totally nailed the fix.', |
||
190 | 'target_type' => 'Issue', |
||
191 | 'target_id' => 3, |
||
192 | 'author_id' => 1, |
||
193 | 'project_id' => 1, |
||
194 | ], |
||
195 | [ |
||
196 | 'message' => ":ship: We've deployed a fix.", |
||
197 | 'target_type' => 'MergeRequest', |
||
198 | 'target_id' => 1, |
||
199 | 'author_id' => 3, |
||
200 | 'project_id' => 2, |
||
201 | ], |
||
202 | [ |
||
203 | 'message' => "We've identified the problem. Our engineers are currently looking at it.", |
||
204 | 'target_type' => 'Issue', |
||
205 | 'target_id' => 1, |
||
206 | 'author_id' => 2, |
||
207 | 'project_id' => 1, |
||
208 | ], |
||
209 | [ |
||
210 | 'message' => 'Something went wrong, with something or another.', |
||
211 | 'target_type' => 'Issue', |
||
212 | 'target_id' => 1, |
||
213 | 'author_id' => 1, |
||
214 | 'project_id' => 2, |
||
215 | ], |
||
216 | [ |
||
217 | 'message' => ':zap: We\'ve seen high response times from our API. It looks to be fixing itself as time goes on.', |
||
218 | 'target_type' => 'MergeRequest', |
||
219 | 'target_id' => 1, |
||
220 | 'author_id' => 1, |
||
221 | 'project_id' => 3, |
||
222 | ], |
||
223 | ]; |
||
224 | |||
225 | Comment::truncate(); |
||
226 | |||
227 | foreach ($defaultComments as $comment) { |
||
228 | Comment::create($comment); |
||
229 | } |
||
230 | } |
||
231 | |||
232 | /** |
||
233 | * Seed the settings table. |
||
234 | * |
||
235 | * @return void |
||
236 | */ |
||
237 | protected function seedSettings() |
||
268 | |||
269 | /** |
||
270 | * Seed the subscribers. |
||
271 | * |
||
272 | * @return void |
||
273 | */ |
||
274 | protected function seedSubscribers() |
||
278 | |||
279 | /** |
||
280 | * Seed the users table. |
||
281 | * |
||
282 | * @return void |
||
283 | */ |
||
284 | protected function seedUsers() |
||
302 | |||
303 | /** |
||
304 | * Get the console command options. |
||
305 | * |
||
306 | * @return array |
||
307 | */ |
||
308 | protected function getOptions() |
||
314 | } |
||
315 |