Skip to content

Commit

Permalink
Implement delete event. Update create event to send full post.
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Jun 8, 2016
1 parent e73df3c commit ce5d980
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Repositories/Eloquent/EloquentPostRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Modules\Blog\Entities\Post;
use Modules\Blog\Entities\Status;
use Modules\Blog\Events\PostWasCreated;
use Modules\Blog\Events\PostWasDeleted;
use Modules\Blog\Events\PostWasUpdated;
use Modules\Blog\Repositories\Collection;
use Modules\Blog\Repositories\PostRepository;
Expand Down Expand Up @@ -56,11 +57,18 @@ public function create($data)

$post->tags()->sync(array_get($data, 'tags', []));

event(new PostWasCreated($post->id, $data));
event(new PostWasCreated($post, $data));

return $post;
}

public function destroy($model)
{
event(new PostWasDeleted($model->id, get_class($model)));

return $model->delete();
}

/**
* Return all resources in the given language
*
Expand Down

0 comments on commit ce5d980

Please sign in to comment.