Skip to content

Commit be2c555

Browse files
authored
Merge pull request #66 from IFRCGo/WN-366
Update ApplicationTableSeeder.php
2 parents 10df2f1 + d679055 commit be2c555

1 file changed

Lines changed: 80 additions & 7 deletions

File tree

database/seeds/ApplicationTableSeeder.php

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,86 @@ class ApplicationTableSeeder extends Seeder
1212
*/
1313
public function run()
1414
{
15-
Application::create([
16-
'tenant_id' => 1,
17-
'tenant_user_id' => 1,
18-
'name' => 'Test App',
19-
'description' => 'App used for testing',
20-
'key' => '1234'
21-
]);
15+
$applications = [
16+
[
17+
'tenant_id' => 1,
18+
'tenant_user_id' => 1,
19+
'name' => 'Test App - No Rules',
20+
'description' => 'App with no policy rules (full access)',
21+
'key' => Application::generateKey(),
22+
'is_active' => true,
23+
'rules' => null,
24+
],
25+
[
26+
'tenant_id' => 1,
27+
'tenant_user_id' => 2,
28+
'name' => 'Test App - All Countries, Preparedness V2 Only',
29+
'description' => 'No country restriction, legacy disabled, preparedness v2 enabled',
30+
'key' => Application::generateKey(),
31+
'is_active' => true,
32+
'rules' => [
33+
'allowed_country_code' => [],
34+
'can_access_legacy_whatnow' => false,
35+
'can_access_preparedness_v2' => true,
36+
],
37+
],
38+
[
39+
'tenant_id' => 1,
40+
'tenant_user_id' => 3,
41+
'name' => 'IRCS WhatNow Messages',
42+
'description' => 'IRCS, NHQ WhatNow Messages — India only, preparedness v2',
43+
'key' => 'PYxJ6xCp2mdftP4FOj0mEDiKAqj1OulC',
44+
'is_active' => true,
45+
'rules' => [
46+
'allowed_country_code' => ['IND'],
47+
'can_access_legacy_whatnow' => false,
48+
'can_access_preparedness_v2' => true,
49+
],
50+
],
51+
[
52+
'tenant_id' => 1,
53+
'tenant_user_id' => 4,
54+
'name' => 'Test App - USA, Legacy + Preparedness V2',
55+
'description' => 'USA only, legacy enabled, preparedness v2 enabled',
56+
'key' => Application::generateKey(),
57+
'is_active' => true,
58+
'rules' => [
59+
'allowed_country_code' => ['USA'],
60+
'can_access_legacy_whatnow' => true,
61+
'can_access_preparedness_v2' => true,
62+
],
63+
],
64+
[
65+
'tenant_id' => 1,
66+
'tenant_user_id' => 5,
67+
'name' => 'Test App - All Countries, Legacy + Preparedness V2',
68+
'description' => 'No country restriction, legacy enabled, preparedness v2 enabled',
69+
'key' => Application::generateKey(),
70+
'is_active' => true,
71+
'rules' => [
72+
'allowed_country_code' => [],
73+
'can_access_legacy_whatnow' => true,
74+
'can_access_preparedness_v2' => true,
75+
],
76+
],
77+
[
78+
'tenant_id' => 1,
79+
'tenant_user_id' => 6,
80+
'name' => 'Test App - USA, Legacy Only',
81+
'description' => 'USA only, legacy enabled, preparedness v2 disabled',
82+
'key' => Application::generateKey(),
83+
'is_active' => true,
84+
'rules' => [
85+
'allowed_country_code' => ['USA'],
86+
'can_access_legacy_whatnow' => true,
87+
'can_access_preparedness_v2' => false,
88+
],
89+
],
90+
];
91+
92+
foreach ($applications as $data) {
93+
Application::create($data);
94+
}
2295
}
2396
}
2497

0 commit comments

Comments
 (0)