Files
test_ea/laravel/app/Console/Commands/SyncStocksCommand.php
2026-02-15 01:34:17 +07:00

41 lines
835 B
PHP

<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Contracts\WbSyncManagerInterface;
use App\Enums\WbEndpoint;
use Illuminate\Console\Command;
final class SyncStocksCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'sync:stocks {--date=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sync stocks from WB test API';
/**
* Execute the console command.
*/
public function handle(WbSyncManagerInterface $manager): int
{
$date = (string)($this->option('date') ?? now()->toDateString());
$manager->start(WbEndpoint::STOCKS, $date);
$this->info('Sync started');
return self::SUCCESS;
}
}