argument('path'); if (!file_exists($path)) { $this->error("File not found: $path"); return Command::FAILURE; } if ($this->option('dry-run')) { $this->info('DRY RUN - No data will be imported.'); } if ($this->option('clear') && !$this->option('dry-run')) { if (!$this->confirm('This will delete ALL existing shipping rates. Are you sure?')) { $this->info('Operation cancelled.'); return Command::SUCCESS; } DB::table('shipping_rates')->truncate(); $this->info('All existing rates cleared.'); } $this->info('Starting shipping rates import...'); $this->info('File: ' . realpath($path)); try { if (!$this->option('dry-run')) { Excel::import(new ShippingRatesImport(), $path); } else { $this->info('Dry run - skipping actual import.'); } $this->info('Shipping rates import completed successfully.'); } catch (Throwable $e) { $this->error('Import failed: ' . $e->getMessage()); $this->line($e->getTraceAsString()); return Command::FAILURE; } return Command::SUCCESS; } }