© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Abdellah

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.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Database Notifications Event Dispatch
FilamentFFilament / ❓┊help
4mo ago
Dispatch Event on AfterStateUpdated()
FilamentFFilament / ❓┊help
13mo ago
Accessing relationship data in form lifecycle hook
FilamentFFilament / ❓┊help
13mo ago
404 after dispatch livewire event
FilamentFFilament / ❓┊help
13mo ago