ldc-boutique-cnc-sable/app/Console/Commands/UpsertPublicHolydaysOnShopsPickupExceptions.php
2026-10-27 09:58:12 +01:00

36 lines
945 B
PHP

<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Jobs\UpsertShopsPickupExceptionsUsingApiForYear;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
#[Description('fetch the public holiday for a specific year or by default for the next year')]
#[Signature('uwil:upsert-shops-hollydays {year?}')]
class UpsertPublicHolydaysOnShopsPickupExceptions extends Command
{
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$year = $this->argument('year');
if (is_numeric($year) === false) {
$this->error('The year must be a number');
return;
}
$this->info('Fetching hollidays upsert shops exceptions using Api');
dispatch(new UpsertShopsPickupExceptionsUsingApiForYear(intval($year)));
$this->info('Done');
}
}