🔄 در حال انجام: تست دستی Filament ⏸️ بلاک: مهاجرت ۳۹۵۰ رکورد (منتظر فایل اکسل اصلاحشده) ⏸️ بلاک: پلاگین وردپرس (بعد از تست کامل API)
33 lines
771 B
PHP
33 lines
771 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Imports\ShippingRatesImport;
|
|
use Illuminate\Console\Command;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
|
|
class ImportShippingRates extends Command
|
|
{
|
|
protected $signature = 'ifnex:import:rates {path : Path to the Excel file}';
|
|
protected $description = 'Import shipping rates from Excel into the shipping_rates table';
|
|
|
|
public function handle(): int
|
|
{
|
|
$path = $this->argument('path');
|
|
|
|
if (!file_exists($path)) {
|
|
$this->error("File not found: $path");
|
|
|
|
return 1;
|
|
}
|
|
|
|
$this->info('Starting shipping rates import...');
|
|
|
|
Excel::import(new ShippingRatesImport(), $path);
|
|
|
|
$this->info('Shipping rates import completed.');
|
|
|
|
return 0;
|
|
}
|
|
}
|