FEATURE: move blog module into own repository
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Modules\Blog\Article\Entities\Comment;
|
||||
|
||||
class CommentsOverview extends Controller
|
||||
{
|
||||
public function getOverview()
|
||||
{
|
||||
$comments = Comment::with('article')
|
||||
->with('author')
|
||||
->orderBy('approved')
|
||||
->orderBy('created_at', 'DESC')
|
||||
->paginate(25);
|
||||
|
||||
return view('article::admin/comments.overview', ['comments' => $comments]);
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Admin\Controller;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Modules\Blog\Article\Entities\Comment;
|
||||
use Modules\Blog\Article\Events\ApprovedComment;
|
||||
use Modules\Blog\Article\Events\DeletedComment;
|
||||
|
||||
class EditComment extends Controller
|
||||
{
|
||||
public function approve($id)
|
||||
{
|
||||
$comment = Comment::findOrFail($id);
|
||||
$comment->approved = 1;
|
||||
$comment->save();
|
||||
|
||||
Event::fire(new ApprovedComment($comment));
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', trans('article::comments.approved'));
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$comment = Comment::findOrFail($id);
|
||||
|
||||
Event::fire(new DeletedComment($comment));
|
||||
|
||||
$comment->delete();
|
||||
|
||||
return redirect()
|
||||
->back()
|
||||
->with('success', trans('article::comments.deleted'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user