Closed
Description
My normal approach for dispatching jobs/sending events would be in the controller action, for example here where we would send an email that a model has been updated:
public function update(Model $model, Request $request) {
$model->update($request->all());
dispatch(new SendModelUpdatedEmail($model));
// ...
}
What would be the recommended approach when extending from the EloquentController
to achieve something similar?
My initial thoughts would be to:
- Override the
update()
method on the controller- Would have to duplicate the code used in the parent class.
- Using Eloquents
updated
event- For me, this logic shouldn't be handled in the Model.