Closed that0n3guy closed 10 years ago
(For completeness I've copied the pull-request comment here)
I think its better to do something like this:
// Create
public function beforeCreate($input);
public function creating($input);
public function afterCreate($model);
// Update
public function beforeUpdate($input);
public function updating($input);
public function afterUpdate($model);
// Delete
public function beforeDelete($model);
public function deleting($model);
public function afterDelete($model);
When you return a response in the after...
methods (e.g. a redirect). That response object will be used instead of the one in the controller.
Right now when you do this:
public function afterCreate()
{
return Redirect::to('/');
}
The Response object will be executed after you create the model and you'll be redirected to the given route or url. This also works on afterUpdate and afterDelete
It would be nice to be able to change where the form redirects after save/update/delete. Useful if you have a create button on a dashboard and want to redirect back to the dashboard rather than the index.
There are lots ways to do this:
destination=
on the urlThe first 2 are easy... not sure about the 3rd.