Filament with spatie event sourcing

I'm trying to create data with spatie event sourcing, when I create the data, event attribute gives me always null.
Currency.php
public static function createWithAttributes(array $attributes): self
{
    $attributes['uuid'] = (string) Uuid::uuid4();

    event(new CurrencyCreated(currencyAttributes: $attributes));

    return static::uuid($attributes['uuid']); <-- give me null
}

ListCurrencies.php
protected function getHeaderActions(): array
{
    return [
        Actions\CreateAction::make()
            ->createAnother(false)
            ->using(function (array $data, string $model): Model {
                return $model::createWithAttributes($data);
            })
            ->icon('heroicon-o-plus')
            ->label('Create')
            ->modalWidth(MaxWidth::Large),
    ];
}

<?php

namespace App\Events;

use Spatie\EventSourcing\StoredEvents\ShouldBeStored;

class CurrencyCreated extends ShouldBeStored
{
    public function __construct(
        public array $currencyAttributes
    ){}
}
Was this page helpful?