{"repo":"chelout/laravel-relationship-events","free":true,"listed":false,"github":"https://github.com/chelout/laravel-relationship-events","clone":"git clone https://github.com/chelout/laravel-relationship-events.git","description":"Missing relationship events for Laravel","language":"PHP","stars":525,"topics":["laravel","relationship","relations","events"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"Laravel Relationship Events Missing relationship events for Laravel Compatibility Package Laravel PHP --------- --------- ----- v5.x 13.x ^8.3 v4.x 12.x ^8.2 v3.x 11.x ^8.2 v2.x 10.x ^8.1 v1.x 6.x - 9.x ^7.2 \\ ^8.0 Install 1. Install package with composer Stable branch: Development branch: 2. Use necessary trait in your model. Available traits: - HasOneEvents - HasBelongsToEvents - HasManyEvents - HasBelongsToManyEvents - HasMorphOneEvents - HasMorphToEvents - HasMorphManyEvents - HasMorphToManyEvents - HasMorphedByManyEvents 3. Dispatchable relationship events. It is possible to fire event classes via $dispatchesEvents properties and adding trait: Relationships - One To One Relations - One To Many Relations - Many To Many Relations - Has Many Through Relations - One To One Polymorphic Relations - One To Many Polymorphic Relations - Many To Many Polymorphic Relations Observers Starting from v0.4 it is possible to use relationship events in Laravel observers classes Usage is very simple. Let's take and classes from One To One Relations, add trait to class. Define observer class: Don't forget to register an observer in the method of your : And now just create profile for user: Todo - Tests, tests, tests","default_branch":null,"files":null,"tree":[],"storefront":"/r/chelout","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/chelout/laravel-relationship-events/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}