This is the documentation for
v4 but the latest version is
v7
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-event-sourcing
By default we store the Event
's FQCN in the database when storing the events. This prevents you from changing the name or the namespace of your event classes.
To get around this you can define event class aliases in the event-sourcing.php
config file:
'event_class_map' => [
'money_added' => MoneyAddedEvent::class,
],
With this configuration, instead of saving \App\Events\MoneyAddedEvent
in the database, it just stores money_added
so you can change the event's classname and namespace. Just make sure to also change the mapping!