FEATURE: add comments management
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user