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