Implement a new Artisan command and Excel import logic to handle tracking data ingestion. This includes registering new commands in the application bootstrap and providing several utility scripts for debugging and testing the import process. - Add `ImportTrackingData` command and `TrackingDataImport` class - Register `ImportShippingRates` and `ImportTrackingData` in `app.php` - Add `ifnex:import:tracking` closure command in `console.php` - Include various debugging and testing scripts for Excel and shipment verification
25 lines
815 B
PHP
25 lines
815 B
PHP
<?php
|
|
require 'vendor/autoload.php';
|
|
$app = require_once 'bootstrap/app.php';
|
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
|
$kernel->bootstrap();
|
|
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use Maatwebsite\Excel\Concerns\ToCollection;
|
|
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
|
use Illuminate\Support\Collection;
|
|
|
|
class DebugImport implements ToCollection, WithHeadingRow
|
|
{
|
|
public function collection(Collection $rows)
|
|
{
|
|
echo 'Total rows: ' . $rows->count() . PHP_EOL;
|
|
if ($rows->count() > 0) {
|
|
echo 'First row keys: ' . implode(', ', $rows->first()->keys()->toArray()) . PHP_EOL;
|
|
echo 'First row AWB: ' . ($rows->first()['AWB'] ?? 'N/A') . PHP_EOL;
|
|
}
|
|
}
|
|
}
|
|
|
|
Excel::import(new DebugImport(), '../01_Documents/Data entry 2026-06-28.xlsx');
|