Laravel - Events - Defining Events
An event class is essentially a data container which holds the information related to the event. For example, let's assume an App\Events\OrderShipped
event receives an Eloquent ORM object:
order = $order;
}
}
As you can see, this event class contains no logic. It is a container for the App\Models\Order
instance that was purchased. The SerializesModels
trait used by the event will gracefully serialize any Eloquent models if the event object is serialized using PHP's serialize
function, such as when utilizing queued listeners.