ldc-boutique-cnc-sable/app/Console/Commands/SyncProductIncosCommand.php
Jérémy Munsch 85f3896337
fix(commands): update command signatures to include 'uwil' prefix
Updated command signatures for MailTest, SyncProductIncosCommand, and UserCreate to maintain consistency in naming conventions.
2026-10-27 09:59:00 +01:00

38 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Actions\ProductIncos\SynchronizeProductIncosWithArcadiaApi;
use App\Contracts\ActionInputEmpty;
use App\Contracts\Executor;
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;
}
}