| 1 | <?php |
||
| 9 | class EloquentStoredEvent extends Model |
||
| 10 | { |
||
| 11 | public $guarded = []; |
||
| 12 | |||
| 13 | public $timestamps = false; |
||
| 14 | |||
| 15 | protected $table = 'stored_events'; |
||
| 16 | |||
| 17 | public $casts = [ |
||
| 18 | 'event_properties' => 'array', |
||
| 19 | 'meta_data' => 'array', |
||
| 20 | ]; |
||
| 21 | |||
| 22 | public function toStoredEvent(): StoredEvent |
||
| 23 | { |
||
| 24 | return new StoredEvent([ |
||
| 25 | 'id' => $this->id, |
||
| 26 | 'event_properties' => $this->event_properties, |
||
| 27 | 'aggregate_uuid' => $this->aggregate_uuid, |
||
| 28 | 'event_class' => $this->event_class, |
||
| 29 | 'meta_data' => $this->meta_data, |
||
| 30 | 'created_at' => $this->created_at, |
||
| 31 | ]); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getEventAttribute(): ShouldBeStored |
||
| 38 | |||
| 39 | public function scopeStartingFrom(Builder $query, int $storedEventId): void |
||
| 43 | |||
| 44 | public function scopeUuid(Builder $query, string $uuid): void |
||
| 48 | } |
||
| 49 |