Skip to content

Commit f341956

Browse files
committed
fix community stores adding all domains
1 parent f831a2c commit f341956

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

app/Filament/Forms/CommunityStoresForm.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* The form integrates with GitHub-hosted community store data and dispatches background jobs
2727
* to process the selected stores and add them to the discount system.
28-
*
2928
*/
3029
class CommunityStoresForm
3130
{
@@ -110,7 +109,7 @@ public static function configure()
110109
Step::make('Select Domains')
111110
->key('select-domains')
112111
->schema([
113-
Hidden::make('domains_selected_files'),
112+
Hidden::make('stores_selected_domains'),
114113

115114
// Domain selection with visual checkboxes
116115
// Fetches available domains for the stores selected in previous step
@@ -127,7 +126,7 @@ public static function configure()
127126

128127
$stores = StoreHelper::get_domains_for_stores($customStores);
129128

130-
$set('domains_selected_files', $stores);
129+
$set('stores_selected_domains', $stores);
131130

132131
return $stores;
133132
})
@@ -147,9 +146,12 @@ public static function configure()
147146
->action(function ($data) {
148147
// Process selected domains and dispatch background jobs
149148
// Each job adds a store to the discount system with its logo from GitHub
150-
foreach ($data['domains_selected_files'] as $domain) {
151-
$image_link = config('settings.github_community_store_gist_base').$domain['store'].'/logo.png';
152-
AddStoreToDiscountJob::dispatch($domain['path'], $image_link);
149+
150+
foreach ($data['domains_selected'] as $domain) {
151+
$current_domain = $data['stores_selected_domains'][$domain];
152+
153+
$image_link = config('settings.github_community_store_gist_base').$current_domain['store'].'/logo.png';
154+
AddStoreToDiscountJob::dispatch($current_domain['path'], $image_link);
153155
}
154156

155157
Notification::make()

0 commit comments

Comments
 (0)