Files
hub/app/Console/Commands/FixManifestOrderStatus.php
Jon Leopard 7e5ea2bc10 checkpoint: marketplace and operational features complete, ready for Week 4 data migration
Summary of completed work:
- Complete buyer portal (browse, cart, checkout, orders, invoices)
- Complete seller portal (orders, manifests, fleet, picking)
- Business onboarding wizards (buyer 4-step, seller 5-step)
- Email verification and registration flows
- Notification system for buyers and sellers
- Payment term surcharges and pickup/delivery workflows
- Filament admin resources (Business, Brand, Product, Order, Invoice, User)
- 51 migrations executed successfully

Renamed Company -> Business throughout codebase for consistency.
Unified authentication flows with password reset.
Added audit trail and telescope for debugging.

Next: Week 4 Data Migration (Days 22-28)
- Product migration (883 products from cannabrands_crm)
- Company migration (81 buyer companies)
- User migration (preserve password hashes)
- Order history migration
2025-10-15 11:17:15 -07:00

66 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Models\Order;
use Illuminate\Console\Command;
class FixManifestOrderStatus extends Command
{
/**
* The name and signature of the console command.
*/
protected $signature = 'orders:fix-manifest-status';
/**
* The console command description.
*/
protected $description = 'Update orders that have manifests but are still at ready_for_manifest status';
/**
* Execute the console command.
*/
public function handle(): int
{
$this->info('Finding orders with manifests stuck at ready_for_manifest status...');
// Find all orders that:
// 1. Have status = 'ready_for_manifest'
// 2. Have an associated manifest
$orders = Order::where('status', 'ready_for_manifest')
->has('manifest')
->get();
if ($orders->isEmpty()) {
$this->info('No orders need to be updated.');
return self::SUCCESS;
}
$this->info("Found {$orders->count()} order(s) to update.");
$bar = $this->output->createProgressBar($orders->count());
$bar->start();
$updated = 0;
foreach ($orders as $order) {
$order->update([
'status' => 'ready_for_delivery',
'ready_for_delivery_at' => $order->ready_for_delivery_at ?? now(),
]);
$updated++;
$bar->advance();
}
$bar->finish();
$this->newLine(2);
$this->info("✅ Successfully updated {$updated} order(s) to ready_for_delivery status.");
return self::SUCCESS;
}
}