Skip to content

Commit 62532b2

Browse files
committed
Set default rules when creating Application
Merge default rule values into attributes['rules'] on Application creation to ensure required keys are present. Adds defaults: can_access_legacy_whatnow = true, can_access_preparedness_v2 = false, allowed_country_code = []. Defaults are merged with any provided rules so callers can override them; existing key generation behavior is unchanged.
1 parent 0b9d8cc commit 62532b2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

app/Classes/Repositories/ApplicationRepository.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public function findIn($ids = [], $columns = ['*'])
5454
public function create(array $attributes)
5555
{
5656
$attributes['key'] = Application::generateKey();
57+
$attributes['rules'] = array_merge([
58+
'can_access_legacy_whatnow' => true,
59+
'can_access_preparedness_v2' => false,
60+
'allowed_country_code' => [],
61+
], $attributes['rules'] ?? []);
5762

5863
return $this->applicationModel->create($attributes);
5964
}

0 commit comments

Comments
 (0)