Skip to content

Commit

Permalink
Move event to repository
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Jun 10, 2016
1 parent 700fc05 commit fb0c07b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Http/Controllers/Admin/PageController.php
Expand Up @@ -99,8 +99,6 @@ public function destroy(Page $page)
{
$this->page->destroy($page);

event(new PageWasDeleted($page));

flash(trans('page::messages.page deleted'));

return redirect()->route('admin.page.page.index');
Expand Down
8 changes: 8 additions & 0 deletions Repositories/Eloquent/EloquentPageRepository.php
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Database\Eloquent\Builder;
use Modules\Core\Repositories\Eloquent\EloquentBaseRepository;
use Modules\Page\Events\PageWasCreated;
use Modules\Page\Events\PageWasDeleted;
use Modules\Page\Events\PageWasUpdated;
use Modules\Page\Repositories\PageRepository;

Expand Down Expand Up @@ -59,6 +60,13 @@ public function update($model, $data)
return $model;
}

public function destroy($model)
{
event(new PageWasDeleted($model));

return $model->delete();
}

/**
* @param $slug
* @param $locale
Expand Down

0 comments on commit fb0c07b

Please sign in to comment.