31 lines
1021 B
PHP
31 lines
1021 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace Modules\Core\Order\Events;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
||
|
|
use Lunar\Models\Order;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Dispatched by Modules\Core\Order\Services\OrderStatusWriter::write()
|
||
|
|
* alongside the generic Modules\Core\Order\Events\OrderStatusUpdated
|
||
|
|
* (which Modules\Core\Order\Observers\OrderObserver dispatches for ANY
|
||
|
|
* `status` write, regardless of cause, and which
|
||
|
|
* OrderStatusUpdatedNotification already listens to). This event exists
|
||
|
|
* only because the audit trail (Modules\Core\Order\Listeners\
|
||
|
|
* RecordStatusTransition) needs $causeClass, which OrderStatusUpdated
|
||
|
|
* does not carry — OrderStatusWriter is the only writer of `status` this
|
||
|
|
* package has left, so it's the only place that needs to know its own
|
||
|
|
* cause.
|
||
|
|
*/
|
||
|
|
class OrderStatusChanged
|
||
|
|
{
|
||
|
|
use Dispatchable;
|
||
|
|
|
||
|
|
public function __construct(
|
||
|
|
public readonly Order $order,
|
||
|
|
public readonly ?string $previousStatus,
|
||
|
|
public readonly string $newStatus,
|
||
|
|
public readonly string $causeClass,
|
||
|
|
) {}
|
||
|
|
}
|