FEATURE: add comments management

This commit is contained in:
Michal Kváček
2016-09-05 16:05:14 +02:00
parent 9ce9f62a45
commit 8f66a96ec0
12 changed files with 137 additions and 6 deletions
@@ -8,8 +8,12 @@ class CommentsOverview extends Controller
{
public function getOverview()
{
$comments = Comment::paginate(20);
$comments = Comment::with('article')
->with('author')
->orderBy('approved')
->orderBy('created_at', 'DESC')
->paginate(20);
dd($comments);
return view('article::admin/comments.overview', ['comments' => $comments]);
}
}
@@ -0,0 +1,33 @@
<?php
namespace Modules\Blog\Article\Http\Controllers\Admin;
use Modules\Blog\Article\Entities\Comment;
use Pingpong\Modules\Routing\Controller;
class EditComment extends Controller
{
public function approve($id)
{
$comment = Comment::findOrFail($id);
$comment->approved = 1;
$comment->save();
// Event::fire(ApprovedComment);
return redirect()
->back()
->with('success', trans('article::comments.approved'));
}
public function delete($id)
{
$comment = Comment::findOrFail($id);
$comment->delete();
// Event::fire(DeletedComment);
return redirect()
->back()
->with('success', trans('article::comments.deleted'));
}
}