krafthaus / bauhaus

Laravel 4 Admin Generator
http://bauhaus.krafthaus.nl/
GNU General Public License v2.0
1 stars 0 forks source link

added more hooks: afterUpdate, afterStore, modifyModelItem, and afterMultiDestroy hooks #28

Closed that0n3guy closed 10 years ago

that0n3guy commented 10 years ago

I needed this hook for some wizardry I was doing with mongodb and embedded documents.

Thought it might be usefull for others... needs documented thought (just like create/update needs documented).

that0n3guy commented 10 years ago

Since I was adding a hook. I decided to add a couple others (I didnt test them yet). These would take care of #26 .

jspekken commented 10 years ago

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.