This is the documentation for
v5 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
The traditional application
In a traditional application, you're probably going to use a database to hold the state of your application. Whenever you want to update a state, you're simply going to overwrite the old value. That old value isn't accessible anymore. Your application only holds the current state.
You might think that you still have the old state inside your backups. But they don't count. Your app probably can't, nor should it, make decisions on data inside those backups.
First, we write value X
Next, we overwrite X by Y. X cannot be accessed anymore.
Here's a demo application that uses a traditional architecture. Inside the AccountsController we are just going to create new accounts and update the balance. We're using an eloquent model to update the database. Whenever we change the balance of the account, the old value is lost.