Total Complexity | 5 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class EquipmentSeeder extends Seeder |
||
9 | { |
||
10 | /** |
||
11 | * Run the database seeds. |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | public function run() |
||
16 | { |
||
17 | // Create sample categories and equipment |
||
18 | $equip = collect([ |
||
19 | 'Cisco' => [ |
||
20 | '1900 Series', |
||
21 | '1800 Series', |
||
22 | '1000 Series', |
||
23 | '2800 Series', |
||
24 | ], |
||
25 | 'AdTran' => [ |
||
26 | 'NetVanta 1500 Series', |
||
27 | '900 Series', |
||
28 | 'NetVanta 1200 Series', |
||
29 | ], |
||
30 | 'Hewlett-Packard' => [ |
||
31 | 'HSR6800 Router Series', |
||
32 | 'MSR2000 Router Series', |
||
33 | |||
34 | ], |
||
35 | ]); |
||
36 | // Create the samle equipment |
||
37 | foreach($equip as $cat => $sys) |
||
38 | { |
||
39 | $catID = SystemCategories::create(['name' => $cat])->cat_id; |
||
40 | foreach($sys as $s) |
||
41 | { |
||
42 | SystemTypes::create([ |
||
43 | 'cat_id' => $catID, |
||
44 | 'name' => $s, |
||
45 | 'folder_location' => str_replace(' ', '_', $s), |
||
46 | ]); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | // Create the information to gather when adding a syste mto a customer |
||
51 | $sysList = SystemTypes::all(); |
||
52 | foreach($sysList as $sys) |
||
53 | { |
||
54 | for($i = 1; $i < 7; $i++) |
||
55 | { |
||
56 | |||
57 | SystemDataFields::create([ |
||
58 | 'sys_id' => $sys->sys_id, |
||
59 | 'data_type_id' => $i, |
||
60 | 'order' => $i - 1, |
||
61 | ]); |
||
66 |