Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Reacter|Reactant models creation on Reacterable|Reactable models creating event #249

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Console/Commands/RegisterReactants.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private function registerModelsAsReactants(

foreach ($models as $model) {
$model->registerAsLoveReactant();
$model->save();
$progressBar->advance();
}

Expand Down
1 change: 1 addition & 0 deletions src/Console/Commands/RegisterReacters.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ private function registerModelsAsReacters(

foreach ($models as $model) {
$model->registerAsLoveReacter();
$model->save();
$progressBar->advance();
}

Expand Down
1 change: 0 additions & 1 deletion src/Reactable/Models/Traits/Reactable.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ public function registerAsLoveReactant(): void
]);

$this->setAttribute('love_reactant_id', $reactant->getId());
$this->save();
}
}
2 changes: 1 addition & 1 deletion src/Reactable/Observers/ReactableObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

final class ReactableObserver
{
public function created(
public function creating(
ReactableInterface $reactable,
): void {
if (
Expand Down
1 change: 0 additions & 1 deletion src/Reacterable/Models/Traits/Reacterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ public function registerAsLoveReacter(): void
]);

$this->setAttribute('love_reacter_id', $reacter->getId());
$this->save();
}
}
2 changes: 1 addition & 1 deletion src/Reacterable/Observers/ReacterableObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

final class ReacterableObserver
{
public function created(
public function creating(
ReacterableInterface $reacterable,
): void {
if (
Expand Down