PHP code example of reallyli / laravel-event-store
1. Go to this page and download the library: Download reallyli/laravel-event-store library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
reallyli / laravel-event-store example snippets
use App\User;
use Uniqueway\LaravelEventStore\ShouldBeStored;
class UserCreated implements ShouldBeStored
{
public $user;
public function __construct(User $user)
{
$this->user = $user;
}
// return stored event data
public function getData()
{
return [
'user_id' => $this->user->id,
];
}
}
$user = User::create(['name' => 'likai'])
event(new UserCreated($user));
shell
php artisan migrate