Skip to content

Commit e593600

Browse files
committed
Perform elasticsearch update on save event
1 parent 2aa6e77 commit e593600

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/ModelObserver.php

+3-13
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,15 @@
55
class ModelObserver
66
{
77
/**
8-
* Handle the created event for the model.
8+
* Handle the saved event for the model.
99
*
1010
* @param \Illuminate\Database\Eloquent\Model $model
1111
*/
12-
public function created($model)
12+
public function saved($model)
1313
{
1414
$model->addToHunt();
1515
}
1616

17-
/**
18-
* Handle the updated event for the model.
19-
*
20-
* @param \Illuminate\Database\Eloquent\Model $model
21-
*/
22-
public function updated($model)
23-
{
24-
$this->created($model);
25-
}
26-
2717
/**
2818
* Handle the deleted event for the model.
2919
*
@@ -41,6 +31,6 @@ public function deleted($model)
4131
*/
4232
public function restored($model)
4333
{
44-
$this->created($model);
34+
$this->saved($model);
4535
}
4636
}

0 commit comments

Comments
 (0)