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
prowler6mo ago
is the event queueable? if so, is there a worker running to process it?
Abdellah
AbdellahOP6mo ago
Thank you manifold @prowler. My bad. I did not register the event.
Want results from more Discord servers?
Add your server