mirror of
https://github.com/filamentphp/filament.git
synced 2026-10-13 17:36:15 +08:00
* Support trait-named lifecycle hooks on pages and importers
Lifecycle hooks such as afterCreate() and afterSave() can currently only
be defined directly on the page class. A trait that defines one of these
hooks is silently overridden as soon as the page declares its own,
which makes it impossible for reusable traits or plugins to reliably
hook into the page lifecycle.
callHook() now also invokes {hook}{TraitName}() for every trait used by
the class (recursively), mirroring how Eloquent boots model traits via
boot{TraitName}(). The class's own hook runs first, followed by each
trait hook. Applies to panel pages (BasePage) and importers (Importer).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Test and document trait lifecycle hooks
Co-authored-by: Amp <amp@ampcode.com>
---------
Co-authored-by: jim <jim@townsend-music.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Dan Harrin <git@danharrin.com>
Co-authored-by: Amp <amp@ampcode.com>