Dispatch event in lifecycle hook

Hello, I want to dispatch an event in the lifecycle hook after creating a resource
class CreateMyResource extends CreateRecord
{
protected static string $resource = MyResource::class;

public function afterCreate(): void
{
...
Event::dispatch(new CreateADatabase($model['id'], $projectId, $branchId, $roleId, $databaseName));
}
}
class CreateMyResource extends CreateRecord
{
protected static string $resource = MyResource::class;

public function afterCreate(): void
{
...
Event::dispatch(new CreateADatabase($model['id'], $projectId, $branchId, $roleId, $databaseName));
}
}
My event is not firing. Is there any other way of firing the event? Thank you.
2 Replies
prowler
prowler4w ago
is the event queueable? if so, is there a worker running to process it?
Abdellah
Abdellah4w ago
Thank you manifold @prowler. My bad. I did not register the event.