From 62532b2a995a882af70724b17bf53a08f57aed6a Mon Sep 17 00:00:00 2001 From: Juan24 Date: Tue, 5 May 2026 16:24:11 -0300 Subject: [PATCH] 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. --- app/Classes/Repositories/ApplicationRepository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Classes/Repositories/ApplicationRepository.php b/app/Classes/Repositories/ApplicationRepository.php index fca4ea0..fc1bace 100644 --- a/app/Classes/Repositories/ApplicationRepository.php +++ b/app/Classes/Repositories/ApplicationRepository.php @@ -54,6 +54,11 @@ public function findIn($ids = [], $columns = ['*']) public function create(array $attributes) { $attributes['key'] = Application::generateKey(); + $attributes['rules'] = array_merge([ + 'can_access_legacy_whatnow' => true, + 'can_access_preparedness_v2' => false, + 'allowed_country_code' => [], + ], $attributes['rules'] ?? []); return $this->applicationModel->create($attributes); }