This commit refactors the import statements in various controllers and jobs to improve code organization and readability. Unused imports were removed, and necessary imports were added to ensure proper functionality.
38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Contracts\ActionInputEmpty;
|
|
use App\Contracts\Executor;
|
|
use App\Cqs\Actions\ProductIncos\SynchronizeProductIncosWithArcadiaApi;
|
|
use App\Jobs\FetchAndUpsertArcadiaProductIncos;
|
|
use Illuminate\Console\Attributes\Description;
|
|
use Illuminate\Console\Attributes\Signature;
|
|
use Illuminate\Console\Command;
|
|
|
|
#[Description('Synchronize all product INCO sheets with Arcadia API')]
|
|
#[Signature('uwil:incos:sync {--queue : Dispatch the synchronization job to the queue}')]
|
|
class SyncProductIncosCommand extends Command
|
|
{
|
|
public function handle(
|
|
Executor $executor,
|
|
SynchronizeProductIncosWithArcadiaApi $action
|
|
): int {
|
|
if ($this->option('queue')) {
|
|
$this->info('Dispatching FetchAndUpsertArcadiaProductIncos job to queue...');
|
|
FetchAndUpsertArcadiaProductIncos::dispatch();
|
|
$this->info('Job dispatched.');
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
|
|
$this->info('Starting synchronous INCO synchronization with Arcadia API...');
|
|
/** @var int $count */
|
|
$count = $executor->execute($action, new ActionInputEmpty());
|
|
$this->info("Successfully synchronized {$count} INCO sheets.");
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|