Skip to content

Commit

Permalink
Use Nova's action response
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentBean committed Jun 15, 2023
1 parent f97ae55 commit fd89840
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@
}
},
"minimum-stability": "stable",
"prefer-stable": true
"prefer-stable": true,
"repositories": [
{
"type": "composer",
"url": "https://nova.laravel.com"
}
]
}
5 changes: 3 additions & 2 deletions src/Nova/Actions/CheckAllKnownProductsExistence.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Collection;
use JustBetter\MagentoProducts\Jobs\CheckKnownProductsExistenceJob;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Actions\ActionResponse;
use Laravel\Nova\Fields\ActionFields;

class CheckAllKnownProductsExistence extends Action
Expand All @@ -17,11 +18,11 @@ class CheckAllKnownProductsExistence extends Action
public $name = 'Check all known products for existence';
public $standalone = true;

public function handle(ActionFields $fields, Collection $models): array
public function handle(ActionFields $fields, Collection $models): ActionResponse
{
CheckKnownProductsExistenceJob::dispatch();

return Action::message('Checking');
return ActionResponse::message('Checking');
}
}

5 changes: 3 additions & 2 deletions src/Nova/Actions/CheckKnownProductsExistence.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Collection;
use JustBetter\MagentoProducts\Jobs\CheckKnownProductsExistenceJob;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Actions\ActionResponse;
use Laravel\Nova\Fields\ActionFields;

class CheckKnownProductsExistence extends Action
Expand All @@ -16,11 +17,11 @@ class CheckKnownProductsExistence extends Action

public $name = 'Check known products for existence';

public function handle(ActionFields $fields, Collection $models): array
public function handle(ActionFields $fields, Collection $models): ActionResponse
{
CheckKnownProductsExistenceJob::dispatch($models->pluck('sku')->toArray());

return Action::message('Checking');
return ActionResponse::message('Checking');
}
}

7 changes: 3 additions & 4 deletions src/Nova/Actions/DiscoverMagentoProducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
use JustBetter\MagentoProducts\Commands\DiscoverMagentoProductsCommand;
use JustBetter\MagentoProducts\Jobs\CheckKnownProductsExistenceJob;
use JustBetter\MagentoProducts\Jobs\DiscoverMagentoProductsJob;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Actions\ActionResponse;
use Laravel\Nova\Fields\ActionFields;

class DiscoverMagentoProducts extends Action
Expand All @@ -19,11 +18,11 @@ class DiscoverMagentoProducts extends Action
public $name = 'Discover Magento Products';
public $standalone = true;

public function handle(ActionFields $fields, Collection $models): array
public function handle(ActionFields $fields, Collection $models): ActionResponse
{
DiscoverMagentoProductsJob::dispatch();

return Action::message('Checking');
return ActionResponse::message('Checking');
}
}

0 comments on commit fd89840

Please sign in to comment.