argument('anno'); $mese = (int) $this->argument('mese'); $indice = (float) $this->argument('indice'); $series = strtoupper((string) $this->option('series')); $source = (string) $this->option('source'); if ($anno < 1900 || $anno > 2300 || $mese < 1 || $mese > 12 || $indice <= 0) { $this->error('Parametri non validi: verifica anno/mese/indice.'); return self::FAILURE; } IstatIndiceMensile::query()->updateOrCreate( [ 'codice_serie' => $series, 'anno' => $anno, 'mese' => $mese, ], [ 'indice' => $indice, 'fonte' => $source, 'sincronizzato_il' => now(), ] ); $this->info("Indice ISTAT salvato: {$series} {$anno}-" . str_pad((string) $mese, 2, '0', STR_PAD_LEFT) . " = {$indice}"); return self::SUCCESS; } }