Download the PHP package parallax/observe-relationships without Composer
On this page you can find all versions of the php package parallax/observe-relationships. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download parallax/observe-relationships
More information about parallax/observe-relationships
Files in parallax/observe-relationships
Package observe-relationships
Short Description observe Relationships
License MIT
Homepage https://parall.ax
Informations about the package observe-relationships
Observe Relationships
This package allows you to configure specific models to trigger update observers for other possible related models.
Whilst Laravel does support the touches
method, you might be using a package model instance where you cannot define the parent -> child relationship,
therefore cannot enable $touches
method. This package does the same thing but controlled via configuration.
E.g. A product might relate to a page, but if the page is change the model doesn't re-index currently. This package allows that to work via config and observes.
Installation
Configuration
On installation the configuration file should be published to your /config
folder. If it is not then run the following:
Inside thie /config/observe-relationship.php
you will see an empty array of models.
The key is the model you want to watch, then the sub arrays are the models you want to trigger.
The required fields for a trigger is model
and field
. On a save of the watcher instance it will
update the updated_at
timestamps of the trigger model.
Example
An example configuration of a Page
model being watched for a change event that will trigger a Product
model to be seen as updated is: