/** * Delete a post and go back. * * @param PostRepositoryInterface $posts * @param Authorizer $authorizer * @param $id * @return \Illuminate\Http\RedirectResponse */ public function delete(PostRepositoryInterface $posts, Authorizer $authorizer, $id) { $authorizer->authorize('anomaly.module.posts::posts.delete'); $posts->delete($posts->find($id)); return redirect()->back(); }
/** * Handle the command. * * @param PostRepositoryInterface $posts */ public function handle(PostRepositoryInterface $posts) { foreach ($this->type->getPosts() as $post) { $posts->delete($post); } }