(Update) Articles System

- add eager loading
- add ability to leave anon comment
- have artle comments count toward achievements
- clean up layout
-  fix lang
This commit is contained in:
HDVinnie
2018-11-05 18:02:56 -05:00
parent 7ccebfcd28
commit fd964de6de
4 changed files with 111 additions and 70 deletions
+17 -2
View File
@@ -74,13 +74,15 @@ class CommentController extends Controller
$comment = new Comment();
$comment->content = $request->input('content');
$comment->anon = $request->input('anonymous');
$comment->user_id = $user->id;
$comment->article_id = $article->id;
$v = validator($comment->toArray(), [
'content' => 'required',
'user_id' => 'required',
'article_id' => 'required'
'article_id' => 'required',
'anon' => 'required'
]);
if ($v->fails()) {
@@ -120,6 +122,20 @@ class CommentController extends Controller
}
}
// Achievements
$user->unlock(new UserMadeComment(), 1);
$user->addProgress(new UserMadeTenComments(), 1);
$user->addProgress(new UserMade50Comments(), 1);
$user->addProgress(new UserMade100Comments(), 1);
$user->addProgress(new UserMade200Comments(), 1);
$user->addProgress(new UserMade300Comments(), 1);
$user->addProgress(new UserMade400Comments(), 1);
$user->addProgress(new UserMade500Comments(), 1);
$user->addProgress(new UserMade600Comments(), 1);
$user->addProgress(new UserMade700Comments(), 1);
$user->addProgress(new UserMade800Comments(), 1);
$user->addProgress(new UserMade900Comments(), 1);
return redirect()->route('article', ['slug' => $article->slug, 'id' => $article->id])
->with(Toastr::success('Your Comment Has Been Added!', 'Yay!', ['options']));
}
@@ -145,7 +161,6 @@ class CommentController extends Controller
$comment = new Comment();
$comment->content = $request->input('content');
;
$comment->anon = $request->input('anonymous');
$comment->user_id = $user->id;
$comment->torrent_id = $torrent->id;