Events
Events serve as a great way to decouple various aspects of the application, or even modify behavior or output of core functionality. A single event can have multiple listeners that do not depend on each other.
Overview#
Statamic will dispatch a number of events in various locations throughout the codebase.
To listen for events, simply create an event listener, type the event name, then handle the event.
use Statamic\Events\SomeEvent;class SomeListener{public function handle(SomeEvent $event){//}}phpphp
For applications with a app/Providers/EventServiceProvider.php
file, you should also register the event listener in the $listen
array:
protected $listen = ['SomeEvent' => ['SomeListener',],];phpphp
For a more in-depth explanation on events, please consult the Laravel documentation.
If you’re creating an addon, you can quickly register event listeners or subscribers.
Available Events#
AssetContainerBlueprintFound#
Statamic\Events\AssetContainerBlueprintFound
Dispatched after Statamic finds the blueprint to be used for an asset in an asset container.
You may modify the blueprint here and it will be reflected in the publish form (and wherever else a blueprint is used). An example of when this would be useful is to add fields to the publish page on the fly.
public function handle(AssetContainerBlueprintFound $event){$event->blueprint;$event->container;}phpphp
AssetContainerCreating#
Statamic\Events\AssetContainerCreating
Dispatched before an asset container is created. You can return false
to prevent it from being created.
public function handle(AssetContainerCreating $event){$event->container;}phpphp
AssetContainerDeleted#
Statamic\Events\AssetContainerDeleted
Dispatched after an asset container has been deleted.
public function handle(AssetContainerDeleted $event){$event->container;}phpphp
AssetContainerSaved#
Statamic\Events\AssetContainerSaved
Dispatched after an asset container has been saved.
public function handle(AssetContainerSaved $event){$event->container;}phpphp
AssetCreated
#
Statamic\Events\AssetCreated
Dispatched after an asset has been created or uploaded.
public function handle(AssetCreated $event){$event->asset;}phpphp
AssetCreating
#
Statamic\Events\AssetCreating
Dispatched before an asset is created or uploaded. You can return false
to prevent it from being created.
public function handle(AssetCreating $event){$event->asset;}phpphp
AssetDeleting#
Statamic\Events\AssetDeleting
Dispatched before an asset is deleted. You can return false
to prevent it from being deleted.
public function handle(AssetDeleting $event){$event->asset;}phpphp
AssetDeleted#
Statamic\Events\AssetDeleted
Dispatched after an asset has been deleted.
public function handle(AssetDeleted $event){$event->asset;}phpphp
AssetFolderDeleted#
Statamic\Events\AssetFolderDeleted
Dispatched after an asset folder has been deleted.
public function handle(AssetFolderDeleted $event){$event->folder;}phpphp
AssetFolderSaved#
Statamic\Events\AssetFolderSaved
Dispatched after an asset folder has been saved.
public function handle(AssetFolderSaved $event){$event->folder;}phpphp
AssetSaved#
Statamic\Events\AssetSaved
Dispatched after an asset has been saved.
public function handle(AssetSaved $event){$event->asset;}phpphp
AssetSaving#
Statamic\Events\AssetSaving
Dispatched before an asset is saved. You can return false
to prevent it from being saved.
public function handle(AssetSaving $event){$event->asset;}phpphp
AssetUploaded#
Statamic\Events\AssetUploaded
Dispatched after an asset has been uploaded.
public function handle(AssetUploaded $event){$event->asset;}phpphp
BlueprintCreating#
Statamic\Events\BlueprintCreating
Dispatched before a blueprint is created. You can return false
to prevent it from being creating.
public function handle(BlueprintCreating $event){$event->blueprint;}phpphp
BlueprintDeleting#
Statamic\Events\BlueprintDeleting
Dispatched before a blueprint is deleted. You can return false
to prevent it from being deleted.
public function handle(BlueprintDeleting $event){$event->blueprint;}phpphp
BlueprintDeleted#
Statamic\Events\BlueprintDeleted
Dispatched after a blueprint has been deleted.
public function handle(BlueprintDeleted $event){$event->blueprint;}phpphp
BlueprintSaved#
Statamic\Events\BlueprintSaved
Dispatched after a blueprint has been saved.
public function handle(BlueprintSaved $event){$event->blueprint;}phpphp
CollectionDeleting#
Statamic\Events\CollectionDeleting
Dispatched before a collection is deleted. You can return false
to prevent it from being deleted.
public function handle(CollectionDeleting $event){$event->collection;}phpphp
CollectionDeleted#
Statamic\Events\CollectionDeleted
Dispatched after a collection has been deleted.
public function handle(CollectionDeleted $event){$event->collection;}phpphp
CollectionCreated#
Statamic\Events\CollectionCreated
Dispatched after a collection has been created.
public function handle(CollectionCreated $event){$event->collection;}phpphp
CollectionCreating#
Statamic\Events\CollectionCreating
Dispatched before a collection is created. You can return false
to prevent it from being created.
public function handle(CollectionCreating $event){$event->collection;}phpphp
CollectionSaved#
Statamic\Events\CollectionSaved
Dispatched after a collection has been saved.
public function handle(CollectionSaved $event){$event->collection;}phpphp
CollectionSaving#
Statamic\Events\CollectionSaving
Dispatched before a collection is saved. You can return false
to prevent it from being saved.
public function handle(CollectionSaving $event){$event->collection;}phpphp
CollectionTreeDeleted#
Statamic\Events\CollectionTreeDeleted
Dispatched after a collection tree has been deleted.
public function handle(CollectionTreeDeleted $event){$event->tree;}phpphp
CollectionTreeSaved#
Statamic\Events\CollectionTreeSaved
Dispatched after a collection tree has been saved.
public function handle(CollectionTreeSaved $event){$event->tree;}phpphp
CollectionTreeSaving#
Statamic\Events\CollectionTreeSaving
Dispatched when a collection tree is being saved. You can return false
to prevent it from being saved.
public function handle(CollectionTreeSaving $event){$event->tree;}phpphp
EntryBlueprintFound#
Statamic\Events\EntryBlueprintFound
Dispatched after Statamic finds the blueprint to be used for an entry.
You may modify the blueprint here and it will be reflected in the publish form (and wherever else a blueprint is used). An example of when this would be useful is to add a section to a blueprint in the publish page on the fly.
public function handle(EntryBlueprintFound $event){$event->blueprint;$event->entry;}phpphp
EntryCreated#
Statamic\Events\EntryCreated
Dispatched after an entry has been created.
public function handle(EntryCreated $event){$event->entry;}phpphp
EntryCreating#
Statamic\Events\EntryCreating
Dispatched before an entry is created. You can return false
to prevent it from being created.
public function handle(EntryCreating $event){$event->entry;}phpphp
EntryDeleting#
Statamic\Events\EntryDeleting
Dispatched before an entry is deleted. You can return false
to prevent it from being deleted.
public function handle(EntryDeleting $event){$event->entry;}phpphp
EntryDeleted#
Statamic\Events\EntryDeleted
Dispatched after an entry has been deleted.
public function handle(EntryDeleted $event){$event->entry;}phpphp
EntrySaved#
Statamic\Events\EntrySaved
Dispatched after an entry has been saved.
public function handle(EntrySaved $event){$event->entry;}phpphp
When an entry has multiple localizations, the EntrySaved
event will be fired for each of those localizations. You may use the $event->isInitial()
method to determine whether the localized entry from the event was the one originally being saved.

EntrySaving#
Statamic\Events\EntrySaving
Dispatched before an entry is saved. You can return false
to prevent it from being saved.
public function handle(EntrySaving $event){$event->entry;}phpphp
EntryScheduleReached#
Statamic\Events\EntryScheduleReached
Disptached whenever a scheduled entry reaches its target date. This event is used in multiple places such as updating search indexes and invalidating caches.
The event will be dispatched on the minute after the scheduled time.
public function handle(EntryScheduleReached $event){$event->entry;}phpphp
FieldsetCreating#
Statamic\Events\FieldsetCreating
Dispatched before a fieldset is created. You can return false
to prevent it from being created.
public function handle(FieldsetCreating $event){$event->fieldset;}phpphp
FieldsetDeleting#
Statamic\Events\FieldsetDeleting
Dispatched before a fieldset is deleted. You can return false
to prevent it from being deleted.
public function handle(FieldsetDeleting $event){$event->fieldset;}phpphp
FieldsetDeleted#
Statamic\Events\FieldsetDeleted
Dispatched after a fieldset has been deleted.
public function handle(FieldsetDeleted $event){$event->fieldset;}phpphp
FieldsetSaved#
Statamic\Events\FieldsetSaved
Dispatched after a fieldset has been saved.
public function handle(FieldsetSaved $event){$event->fieldset;}phpphp
FormBlueprintFound#
Statamic\Events\FormBlueprintFound
Dispatched after Statamic finds the blueprint to be used for a form.
You may modify the blueprint here and it will be reflected in the publish form (and wherever else a blueprint is used). An example of when this would be useful is to add a section to a blueprint in the publish page on the fly.
public function handle(FormBlueprintFound $event){$event->blueprint;$event->form;}phpphp
FormCreating#
Statamic\Events\FormCreating
Dispatched before a form is created. You can return false
to prevent it from being created.
public function handle(FormCreating $event){$event->form;}phpphp
FormDeleting#
Statamic\Events\FormDeleting
Dispatched before a form is deleted. You can return false
to prevent it from being deleted.
public function handle(FormDeleting $event){$event->form;}phpphp
FormDeleted#
Statamic\Events\FormDeleted
Dispatched after a form has been deleted.
public function handle(FormDeleted $event){$event->form;}phpphp
FormSaved#
Statamic\Events\FormSaved
Dispatched after a form has been saved.
public function handle(FormSaved $event){$event->form;}phpphp
FormSubmitted#
Statamic\Events\FormSubmitted
Dispatched when a Form is submitted on the front-end, before the Submission is created.
public function handle(FormSubmitted $event){$event->submission; // The Submission object}phpphp
You can return false
to prevent the submission, but appear to the user as though it succeeded.
If you’d like to show validation errors, you may throw an Illuminate\Validation\ValidationException
:
throw ValidationException::withMessages(['You did something wrong.']);phpphp
You may also just modify the submission object. You do not need to return
anything.
GlideCacheCleared#
Statamic\Events\GlideCacheCleared
Dispatched after the Glide cache has been cleared, either via the php please glide:clear
command or via the Cache Manager utility.
public function handle(GlideCacheCleared $event){//}phpphp
GlideImageGenerated#
Statamic\Events\GlideImageGenerated
Dispatched after Glide generates an image.
public function handle(GlideImageGenerated $event){$event->path;$event->params;}phpphp
GlobalSetCreating#
Statamic\Events\GlobalSetCreating
Dispatched before a global set is created. You can return false
to prevent it from being created.
public function handle(GlobalSetCreating $event){$event->globals;}phpphp
GlobalSetDeleting#
Statamic\Events\GlobalSetDeleting
Dispatched before a global set is deleted. You can return false
to prevent it from being deleted.
public function handle(GlobalSetDeleting $event){$event->globals;}phpphp
GlobalSetDeleted#
Statamic\Events\GlobalSetDeleted
Dispatched after a global set has been deleted.
public function handle(GlobalSetDeleted $event){$event->globals;}phpphp
GlobalSetSaved#
Statamic\Events\GlobalSetSaved
Dispatched after a global set has been saved.
public function handle(GlobalSetSaved $event){$event->globals;}phpphp
GlobalVariablesCreated#
Statamic\Events\GlobalVariablesCreated
Dispatched after Global Variables have been created.
public function handle(GlobalVariablesCreated $event){$event->variables;}phpphp
GlobalVariablesCreating#
Statamic\Events\GlobalVariablesCreating
Dispatched before Global Variables are created. You can return false
to prevent it from being created.
public function handle(GlobalVariablesCreating $event){$event->variables;}phpphp
GlobalVariablesDeleting#
Statamic\Events\GlobalVariablesDeleting
Dispatched after Global Variables have been deleted.
public function handle(GlobalVariablesDeleting $event){$event->variables;}phpphp
GlobalVariablesDeleted#
Statamic\Events\GlobalVariablesDeleted
Dispatched before Global Variables are deleted. You can return false
to prevent it from being deleted.
public function handle(GlobalVariablesDeleted $event){$event->variables;}phpphp
GlobalVariablesSaved#
Statamic\Events\GlobalVariablesSaved
Dispatched after Global Variables have been saved.
public function handle(GlobalVariablesDeleting $event){$event->variables;}phpphp
GlobalVariablesSaving#
Statamic\Events\GlobalVariablesSaving
Dispatched before Global Variables are saved. You can return false
to prevent it from being saved.
public function handle(GlobalVariablesSaving $event){$event->variables;}phpphp
GlobalVariablesBlueprintFound#
Statamic\Events\GlobalVariablesBlueprintFound
Dispatched after Statamic finds the blueprint to be used for a variables in a global set. (Variables meaning the globals localized to a particular site)
You may modify the blueprint here and it will be reflected in the publish form (and wherever else a blueprint is used). An example of when this would be useful is to add a section to a blueprint in the publish page on the fly.
public function handle(GlobalVariablesBlueprintFound $event){$event->blueprint;$event->globals;}phpphp
ImpersonationStarted#
Statamic\Events\ImpersonationStarted
Dispatched whenever a user starts impersonating another user.
public function handle(ImpersonationStarted $event){$event->impersonator; // The other who started impersonating the other.$event->impersonated; // The user being impersonated.}phpphp
ImpersonationEnded#
Statamic\Events\ImpersonationEnded
Dispatched whenever a user finishes impersonating another user.
public function handle(ImpersonationEnded $event){$event->impersonator; // The other who started impersonating the other.$event->impersonated; // The user being impersonated.}phpphp
LicensesRefreshed#
Statamic\Events\LicensesRefreshed
Dispatched when a user manually triggers a “Sync” of a site’s licenses via the Licenses utility.
public function handle(LicensesRefreshed $event){//}phpphp
LicenseSet#
Statamic\Events\LicenseSet
Dispatched after a license key has been set via the php please license:set
command.
public function handle(LicenseSet $event){//}phpphp
LocalizedTermDeleted#
Statamic\Events\LocalizedTermDeleted
Dispatched after a taxonomy term has been deleted.
This event is similar to the TermDeleted
event, however, instead of $term
being a Term
instance, it will be a LocalizedTerm
instance.
public function handle(LocalizedTermDeleted $event){$event->term;}phpphp
LocalizedTermSaved#
Statamic\Events\LocalizedTermSaved
Dispatched after a taxonomy term has been saved.
This event is similar to the TermSaved
event, however, instead of $term
being a Term
instance, it will be a LocalizedTerm
instance.
public function handle(LocalizedTermSaved $event){$event->term;}phpphp
NavCreated#
Statamic\Events\NavCreated
Dispatched after a nav has been created.
public function handle(NavCreated $event){$event->nav;}phpphp
NavCreating#
Statamic\Events\NavCreating
Dispatched before a nav is created. You can return false
to prevent it from being created.
public function handle(NavCreating $event){$event->nav;}phpphp
NavDeleting#
Statamic\Events\NavDeleting
Dispatched before a nav is deleted. You can return false
to prevent it from being deleted.
public function handle(NavDeleting $event){$event->nav;}phpphp
NavDeleted#
Statamic\Events\NavDeleted
Dispatched after a nav has been deleted.
public function handle(NavDeleted $event){$event->nav;}phpphp
NavSaved#
Statamic\Events\NavSaved
Dispatched after a nav has been saved.
public function handle(NavSaved $event){$event->nav;}phpphp
NavSaving#
Statamic\Events\NavSaving
Dispatched before a nav is saved. You can return false
to prevent it from being saved.
public function handle(NavSaving $event){$event->nav;}phpphp
NavTreeSaved#
Statamic\Events\NavTreeSaved
Dispatched after a nav tree has been saved.
public function handle(NavTreeSaved $event){$event->tree;}phpphp
NavTreeSaving#
Statamic\Events\NavTreeSaving
Dispatched when a nav tree is being saved. You can return false
to prevent it from being saved.
public function handle(NavTreeSaving $event){$event->tree;}phpphp
ResponseCreated#
Statamic\Events\ResponseCreated
Dispatched after Statamic finishes creating the response to send to the front-end. You may wish to modify the response to add headers, etc.
public function handle(ResponseCreated $event){$event->response; // The Response object}phpphp
RevisionDeleted#
Statamic\Events\RevisionDeleted
Dispatched after a revision of an entry has been deleted.
public function handle(RevisionDeleted $event){$event->revision;}phpphp
RevisionSaving#
Statamic\Events\RevisionSaving
Dispatched before a revision of an entry is saved. You can return false
to prevent it from being saved.
public function handle(RevisionSaving $event){$event->revision;}phpphp
RevisionSaved#
Statamic\Events\RevisionSaved
Dispatched after a revision of an entry has been saved.
public function handle(RevisionSaved $event){$event->revision;}phpphp
RoleDeleted#
Statamic\Events\RoleDeleted
Dispatched after a role has been deleted.
public function handle(RoleDeleted $event){$event->role;}phpphp
RoleSaved#
Statamic\Events\RoleSaved
Dispatched after a role has been saved.
public function handle(RoleSaved $event){$event->role;}phpphp
SearchIndexUpdated#
Statamic\Events\SearchIndexUpdated
Dispatched when a search index is updated, either via the php please search:update
command or via the Search utility.
public function handle(SearchIndexUpdated $event){$event->index;}phpphp
SiteCreated#
Statamic\Events\SiteCreated
Dispatched when a site is created via the Control Panel.
public function handle(SiteCreated $event){$event->site;}phpphp
SiteDeleted#
Statamic\Events\SiteDeleted
Dispatched when a site is deleted via the Control Panel.
public function handle(SiteDeleted $event){$event->site;}phpphp
SiteSaved#
Statamic\Events\SiteSaved
Dispatched when a site is saved via the Control Panel.
public function handle(SiteSaved $event){$event->site;}phpphp
StacheCleared#
Statamic\Events\StacheCleared
Dispatched after the Stache cache has been cleared, either via the php please stache:clear
command or via the Cache Manager utility.
public function handle(StacheCleared $event){//}phpphp
StacheWarmed#
Statamic\Events\StacheWarmed
Dispatched after the Stache cache has been warmed, either via the php please stache:warm
command or via the Cache Manager utility.
public function handle(StacheWarmed $event){//}phpphp
StaticCacheCleared#
Statamic\Events\StaticCacheCleared
Dispatched after the Static Cache has been cleared, either via the php please static:clear
command or via the Cache Manager utility.
public function handle(StaticCacheCleared $event){//}phpphp
SubmissionCreated#
Statamic\Events\SubmissionCreated
Dispatched after a form submission has been created. This happens after has a form has been submitted on the front-end.
public function handle(SubmissionCreated $event){$event->submission;}phpphp
If you’re looking to prevent a form being submitted or trigger validation errors, check out the FormSubmitted event.
SubmissionCreating#
Statamic\Events\SubmissionCreating
Dispatched before a submission is created. You can return false
to prevent it from being created.
public function handle(SubmissionCreating $event){$event->submission;}phpphp
SubmissionDeleted#
Statamic\Events\SubmissionDeleted
Dispatched after a form submission has been deleted.
public function handle(SubmissionDeleted $event){$event->submission;}phpphp
SubmissionSaved#
Statamic\Events\SubmissionSaved
Dispatched after a form submission has been saved.
public function handle(SubmissionSaved $event){$event->submission;}phpphp
TaxonomyCreating#
Statamic\Events\TaxonomyCreating
Dispatched before a taxonomy is created. You can return false
to prevent it from being created.
public function handle(TaxonomyCreating $event){$event->taxonomy;}phpphp
TaxonomyDeleting#
Statamic\Events\TaxonomyDeleting
Dispatched before a taxonomy is deleted. You can return false
to prevent it from being deleted.
public function handle(TaxonomyDeleting $event){$event->taxonomy;}phpphp
TaxonomyDeleted#
Statamic\Events\TaxonomyDeleted
Dispatched after a taxonomy has been deleted.
public function handle(TaxonomyDeleted $event){$event->taxonomy;}phpphp
TaxonomySaved#
Statamic\Events\TaxonomySaved
Dispatched after a taxonomy has been saved.
public function handle(TaxonomySaved $event){$event->taxonomy;}phpphp
TermBlueprintFound#
Statamic\Events\TermBlueprintFound
Dispatched after Statamic finds the blueprint to be used for a taxonomy term.
You may modify the blueprint here and it will be reflected in the publish form (and wherever else a blueprint is used). An example of when this would be useful is to add a section to a blueprint in the publish page on the fly.
public function handle(TermBlueprintFound $event){$event->blueprint;$event->term;}phpphp
TermCreating#
Statamic\Events\TermCreating
Dispatched before a taxonomy term is created. You can return false
to prevent it from being created.
public function handle(TermCreating $event){$event->term;}phpphp
TermDeleting#
Statamic\Events\TermDeleting
Dispatched before a taxonomy term is deleted. You can return false
to prevent it from being deleted.
public function handle(TermDeleting $event){$event->term;}phpphp
TermDeleted#
Statamic\Events\TermDeleted
Dispatched after a taxonomy term has been deleted.
This event is similar to the LocalizedTermDeleted
event, however, instead of $term
being a LocalizedTerm
instance, it will be a Term
instance.
public function handle(TermDeleted $event){$event->term;}phpphp
TermSaved#
Statamic\Events\TermSaved
Dispatched after a taxonomy term has been saved.
This event is similar to the LocalizedTermSaved
event, however, instead of $term
being a LocalizedTerm
instance, it will be a Term
instance.
public function handle(TermSaved $event){$event->term;}phpphp
UserBlueprintFound#
Statamic\Events\UserBlueprintFound
Dispatched after Statamic finds the blueprint to be used for a user.
You may modify the blueprint here and it will be reflected in the publish form (and wherever else a blueprint is used). An example of when this would be useful is to add a section to a blueprint in the publish page on the fly.
public function handle(UserBlueprintFound $event){$event->blueprint;}phpphp
UserCreating#
Statamic\Events\UserCreating
Dispatched before a user is created. You can return false
to prevent it from being created.
public function handle(UserCreating $event){$event->user;}phpphp
UserDeleting#
Statamic\Events\UserDeleting
Dispatched before a user is deleted. You can return false
to prevent it from being deleted.
public function handle(UserDeleting $event){$event->user;}phpphp
UserDeleted#
Statamic\Events\UserDeleted
Dispatched after a user has been deleted.
public function handle(UserDeleted $event){$event->user;}phpphp
UserGroupDeleted#
Statamic\Events\UserGroupDeleted
Dispatched after a user group has been deleted.
public function handle(UserGroupDeleted $event){$event->group;}phpphp
UserGroupSaved#
Statamic\Events\UserGroupSaved
Dispatched after a user group has been saved.
public function handle(UserGroupSaved $event){$event->group;}phpphp
UserPasswordChanged#
Statamic\Events\UserPasswordChanged
Dispatched when the password of another user has been changed in the Control Panel.
public function handle(UserPasswordChanged $event){$event->user;}phpphp
UserRegistering#
Statamic\Events\UserRegistering
Dispatched before a user is saved.
You can return false to prevent the submission, but appear to the user as though it succeeded.
public function handle(UserRegistering $event){$event->user;}phpphp
UserRegistered#
Statamic\Events\UserRegistered
Dispatched after a user is saved.
public function handle(UserRegistered $event){$event->user;}phpphp
UserSaved#
Statamic\Events\UserSaved
Dispatched after a user has been saved.
public function handle(UserSaved $event){$event->user;}phpphp
UrlInvalidated#
Statamic\Events\UrlInvalidated
Dispatched after a URL has been removed from the static cache.
public function handle(UrlInvalidated $event){$event->url;}phpphp
Docs Feedback
Submit improvements, related content, or suggestions through Github.
Betterify this page