74525e8955
Phase 1: QR Code Generation
- Create GenerateQrCodeOnOrderCreated listener
- Generate secure random token on order creation
- Create SVG QR codes pointing to /ops/orders/{token}
- Store QR token and generation timestamp on order record
- Register listener in EventServiceProvider
Phase 2: Ops Controller & Routes
- Create OpsController with showOrder() landing page
- Implement confirmPacking() to capture dimensions via form
- Add markInspectionPassed() and flagInspectionIssue() methods
- Implement getAvailableActions() state machine for UI
- Add routes: GET /ops/orders/{token}, POST /ops/orders/{id}/pack, etc.
- Token-gated access, requires auth middleware
Next: Create Blade templates for state-driven UI
116 lines
3.2 KiB
PHP
116 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Events\BalancePaid;
|
|
use App\Events\DepositPaid;
|
|
use App\Events\OrderCreated;
|
|
use App\Events\OrderPacked;
|
|
use App\Events\ParcelCollected;
|
|
use App\Events\ParcelDelivered;
|
|
use App\Events\ParcelFailedDelivery;
|
|
use App\Events\ParcelInTransit;
|
|
use App\Events\ProofApproved;
|
|
use App\Events\ProofRevisionRequested;
|
|
use App\Events\ProofUploaded;
|
|
use App\Events\ReadyToShipIntent;
|
|
use App\Events\ShipmentCreated;
|
|
use App\Events\ShipmentCreationFailed;
|
|
use App\Listeners\CreateShipmentOnReadyToShip;
|
|
use App\Listeners\GenerateQrCodeOnOrderCreated;
|
|
use App\Listeners\NotifySlackOnOrderCreated;
|
|
use App\Listeners\NotifySlackOnOrderPacked;
|
|
use App\Listeners\NotifySlackOnParcelCollected;
|
|
use App\Listeners\NotifySlackOnParcelDelivered;
|
|
use App\Listeners\NotifySlackOnParcelFailedDelivery;
|
|
use App\Listeners\NotifySlackOnShipmentCreated;
|
|
use App\Listeners\NotifySlackOnShipmentCreationFailed;
|
|
use Illuminate\Auth\Events\Registered;
|
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
|
|
|
class EventServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* The event to listener mappings for the application.
|
|
*
|
|
* @var array<class-string, array<int, class-string>>
|
|
*/
|
|
protected $listen = [
|
|
// Order events
|
|
OrderCreated::class => [
|
|
NotifySlackOnOrderCreated::class,
|
|
GenerateQrCodeOnOrderCreated::class,
|
|
],
|
|
|
|
// Packing events
|
|
OrderPacked::class => [
|
|
NotifySlackOnOrderPacked::class,
|
|
],Ready to Ship intent (from Trello webhook)
|
|
ReadyToShipIntent::class => [
|
|
CreateShipmentOnReadyToShip::class,
|
|
],
|
|
|
|
//
|
|
|
|
// Shipment events
|
|
ShipmentCreated::class => [
|
|
NotifySlackOnShipmentCreated::class,
|
|
],
|
|
ShipmentCreationFailed::class => [
|
|
NotifySlackOnShipmentCreationFailed::class,
|
|
],
|
|
|
|
// Courier events
|
|
ParcelCollected::class => [
|
|
NotifySlackOnParcelCollected::class,
|
|
],
|
|
ParcelInTransit::class => [
|
|
// TODO: Add listener
|
|
],
|
|
ParcelDelivered::class => [
|
|
NotifySlackOnParcelDelivered::class,
|
|
],
|
|
ParcelFailedDelivery::class => [
|
|
NotifySlackOnParcelFailedDelivery::class,
|
|
],
|
|
|
|
// Custom order events (listeners TODO)
|
|
DepositPaid::class => [
|
|
// TODO: NotifySlackOnDepositPaid
|
|
],
|
|
ProofUploaded::class => [
|
|
// TODO: NotifySlackOnProofUploaded
|
|
],
|
|
ProofApproved::class => [
|
|
// TODO: NotifySlackOnProofApproved
|
|
],
|
|
ProofRevisionRequested::class => [
|
|
// TODO: NotifySlackOnProofRevisionRequested
|
|
],
|
|
BalancePaid::class => [
|
|
// TODO: NotifySlackOnBalancePaid
|
|
],
|
|
|
|
Registered::class => [
|
|
SendEmailVerificationNotification::class,
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Disable automatic event discovery to avoid permission issues
|
|
*/
|
|
public function shouldDiscoverEvents(): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Register any events for your application.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
//
|
|
}
|
|
}
|