Skip to content

Commit 28a5158

Browse files
Merge pull request #22 from mattpramschufer/master
Updated Readme to include additional documentation
2 parents 3c36cf9 + 314c90a commit 28a5158

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ $post->delete(); // Soft delete the post, which will also trigger the delete() m
6464

6565
Because this trait hooks into the `deleting` Eloquent model event, we can prevent the parent record from being deleted as well as any child records, if any exception is triggered. A `LogicException` will be triggered if the model does not use the `Illuminate\Database\Eloquent\SoftDeletes` trait, or if any of the defined `cascadeDeletes` relationships do not exist, or do not return an instance of `Illuminate\Database\Eloquent\Relations\Relation`.
6666

67+
**Additional Note**: If you already have existing event listeners in place for a model that is going to cascade soft deletes, you can adjust the priority or firing order of events to have CascadeSoftDeletes fire after your event. To do this you can set the priority of your deleting event listener to be 1.
68+
69+
`MODEL::observe( MODELObserver::class, 1 );` The second param is the priority.
70+
71+
`MODEL::deleting( MODELObserver::class, 1 );`
72+
73+
As of right now this is not documented in the Larvel docs, but just know that the default priority is `0` for all listeners, and that `0` is the lowest priority. Passing a param of greater than `0` to your listener will cause your listener to fire before listeners with default priority of `0`
74+
75+
6776
## Installation
6877

6978
This trait is installed via [Composer](http://getcomposer.org/). To install, simply add to your `composer.json` file:

0 commit comments

Comments
 (0)