Skip to content

Commit

Permalink
dispatch IndexHydrate when model instance is created (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmogo authored Jun 16, 2022
1 parent 12b6715 commit 0109a85
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Database/Eloquent/HasEnigma.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public static function bootHasEnigma(): void
$model->attributes
);
});

static::created(static function ($model) {
if (! empty($model->getEnigmaEncryptable())) {
dispatch(new IndexHydrate(get_class($model), $model->id))
->onQueue('enigma');
}
});
}

/**
Expand Down

0 comments on commit 0109a85

Please sign in to comment.