first commit
This commit is contained in:
40
laravel/app/Console/Commands/SyncStocksCommand.php
Normal file
40
laravel/app/Console/Commands/SyncStocksCommand.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user