Skip to content

Commit 162f17d

Browse files
Add defer option (#13)
1 parent a95aadd commit 162f17d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": "^8.3",
2020
"bolechen/nova-activitylog": "^0.5.0",
2121
"justbetter/laravel-magento-async-nova": "^4.0",
22-
"justbetter/laravel-magento-prices": "^2.0",
22+
"justbetter/laravel-magento-prices": "^2.4.5",
2323
"laravel/framework": "^11.0|^12.0",
2424
"laravel/nova": "^5.0"
2525
},

src/Nova/Actions/RetrieveAllPrices.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Laravel\Nova\Actions\Action;
99
use Laravel\Nova\Actions\ActionResponse;
1010
use Laravel\Nova\Fields\ActionFields;
11+
use Laravel\Nova\Fields\Boolean;
1112
use Laravel\Nova\Fields\DateTime;
1213
use Laravel\Nova\Http\Requests\NovaRequest;
1314

@@ -29,7 +30,10 @@ public function handle(ActionFields $fields, Collection $models): ActionResponse
2930
$carbon = Carbon::parse($from);
3031
}
3132

32-
RetrieveAllPricesJob::dispatch($carbon ?? null);
33+
/** @var bool $defer */
34+
$defer = $fields->get('defer');
35+
36+
RetrieveAllPricesJob::dispatch($carbon ?? null, $defer);
3337

3438
return ActionResponse::message(__('Retrieving...'));
3539
}
@@ -39,6 +43,10 @@ public function fields(NovaRequest $request): array
3943
return [
4044
DateTime::make(__('From'), 'from')
4145
->help(__('Optional, retrieve updated prices from this date')),
46+
47+
Boolean::make(__('Defer'), 'defer')
48+
->default(true)
49+
->help(__('When enabled, the prices will be marked for retrieval. Otherwise, all prices will be retrieved immediately.')),
4250
];
4351
}
4452
}

0 commit comments

Comments
 (0)