{"id":28472018,"url":"https://github.com/parallax/observe-relationships","last_synced_at":"2025-07-01T22:30:56.033Z","repository":{"id":57035904,"uuid":"261491838","full_name":"parallax/observe-relationships","owner":"parallax","description":"Automatically trigger indexing based on relational data changes","archived":false,"fork":false,"pushed_at":"2020-05-05T15:15:10.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-30T00:11:22.502Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/parallax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-05T14:16:29.000Z","updated_at":"2020-05-05T15:11:00.000Z","dependencies_parsed_at":"2022-08-24T14:11:06.080Z","dependency_job_id":null,"html_url":"https://github.com/parallax/observe-relationships","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/parallax/observe-relationships","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parallax%2Fobserve-relationships","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parallax%2Fobserve-relationships/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parallax%2Fobserve-relationships/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parallax%2Fobserve-relationships/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parallax","download_url":"https://codeload.github.com/parallax/observe-relationships/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parallax%2Fobserve-relationships/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263046069,"owners_count":23405127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-07T11:09:40.886Z","updated_at":"2025-07-01T22:30:56.015Z","avatar_url":"https://github.com/parallax.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Observe Relationships\n\nThis package allows you to configure specific models to trigger update observers for other possible related models.\nWhilst Laravel does support the `touches` method, you might be using a package model instance where you cannot define the parent -\u003e child relationship, \ntherefore cannot enable `$touches` method. This package does the same thing but controlled via configuration. \n\nE.g. A product might relate to a page, but if the page is change the model doesn't re-index currently. \nThis package allows that to work via config and observes.\n\n## Installation\n```bash\ncomposer require parallax/observe-relationships\n```\n\n## Configuration\nOn installation the configuration file should be published to your `/config` folder. If it is not then run the following:\n```bash\nphp artisan vendor:publish --provider=Parallax\\ObserveRelationship\\ObserveRelationshipProvider\n```\n\nInside thie `/config/observe-relationship.php` you will see an empty array of models.\n\nThe key is the model you want to watch, then the sub arrays are the models you want to trigger. \nThe required fields for a trigger is `model` and `field`. On a save of the watcher instance it will \nupdate the `updated_at` timestamps of the trigger model.\n\n\n### Example\nAn example configuration of a `Page` model being watched for a change event that will trigger a `Product` model to be seen as updated is:\n\n```php\nreturn [\n    'models' =\u003e [\n        \\App\\Models\\Page::class =\u003e [\n            [\n                'model' =\u003e \\App\\Models\\Product::class,\n                'field' =\u003e 'page_id'\n            ]\n        ]\n    ]\n];\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparallax%2Fobserve-relationships","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparallax%2Fobserve-relationships","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparallax%2Fobserve-relationships/lists"}