Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filamentβ€’7mo agoβ€’
12 replies
Adam Holmes

Observing models and relationships

Hi,

I have 2 models for example say
Library
Library
and
Book
Book
. On my Library create page I can select the books that belong to this library. When I save the library, the books are also saved in the relationship table.

I have a
LibraryObserver
LibraryObserver
so that I can perform some processing when it is created - however, the processing involves the books too.

The issue I have is that in the
public function created(Library $library)
public function created(Library $library)
method of my
LibraryObserver
LibraryObserver
the relationship doesn't exist yet (presumably because it hasn't been saved at this point - because we're firing on the
Library
Library
created event).

Anyone have any ideas how I can get around this?

One option is to add all the logic into the form schema in the after create (I think) but I'd like it to be centralised logic rather that attached to the form.

Thanks in advance πŸ™‚
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

multiple models with relationships with Wizard Steps
FilamentFFilament / β“β”Šhelp
3y ago
EditRecord and relationships
FilamentFFilament / β“β”Šhelp
3y ago
Searchable for models/relationships with different database connections
FilamentFFilament / β“β”Šhelp
2y ago
Selects and Nested Relationships
FilamentFFilament / β“β”Šhelp
3y ago