Skip to content

Conversation

@ginkelsoft-development
Copy link
Owner

No description provided.

…ted search indexes

This commit introduces a new global observer (`SearchIndexObserver`) that listens to all
Eloquent model events via `Event::listen('eloquent.*: *', ...)`. The observer automatically
rebuilds or removes search index entries for models using the `HasEncryptedSearchIndex` trait.

Key changes:
- Added `Ginkelsoft\EncryptedSearch\Observers\SearchIndexObserver` class
- Handles `created`, `updated`, `saved`, `touched`, and `restored` events → reindex
- Handles `deleted` and `forceDeleted` events → remove index
- Added support for recursive trait detection via `class_uses_recursive`
- Requires trait methods `updateSearchIndex()` and `removeSearchIndex()` to be public

This ensures consistent and automatic synchronization between model lifecycle events
and the encrypted search index, including `touch()` and soft delete operations.
@ginkelsoft-development ginkelsoft-development merged commit 8e1ce0a into main Oct 10, 2025
0 of 10 checks passed
ginkelsoft-development added a commit that referenced this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants