Skip to content

Commit

Permalink
Update ModelObserver.php
Browse files Browse the repository at this point in the history
  • Loading branch information
emildayan authored Dec 25, 2021
1 parent 5fe8668 commit d9c1611
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ModelObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function updated($model)
$this->created($model);
}

/**
/**
* Handle the deleted event for the model.
*
* @param \Illuminate\Database\Eloquent\Model $model
Expand All @@ -79,7 +79,17 @@ public function deleted($model)
if (static::syncingDisabledFor($model)) {
return;
}
if (!in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses($model->getMorphClass())))
{
$model->unIndexRecord();
}
}

public function forceDeleted($model)
{
if (static::syncingDisabledFor($model)) {
return;
}
$model->unIndexRecord();
}

Expand Down

0 comments on commit d9c1611

Please sign in to comment.