profile
viewpoint

Ask questionsSchemalessAttributes needed?

Hi! Love the package!

I'm building custom repositories to store and load events from https://eventstore.com/ so I'm not using Eloquent at all.

I liked the use of StoredEvent, except for the SchemalessAttributes requirement. This type then enforces all of Eloquent to be brought in.

https://github.com/spatie/laravel-event-sourcing/blob/ea48283a7a0db3a5c090de799df8cf01f5918f69/src/StoredEvent.php#L24

At the moment I'm using a workaround, but it's not pretty!

        use Illuminate\Database\Eloquent\Model;
        $emptyModel = new class extends Model { };
        $model = new $emptyModel();
        $model->meta_data = $metadata;

        return new StoredEvent([
            ...
            'meta_data' => new SchemalessAttributes($model, 'meta_data'),
            ...
        ]);
spatie/laravel-event-sourcing

Answer questions morrislaptop

Done!

useful!

Related questions

No questions were found.
Github User Rank List