diff --git a/app/Http/Controllers/Projects/CommentsController.php b/app/Http/Controllers/Projects/CommentsController.php
index 7fac242..dfe8a6c 100644
--- a/app/Http/Controllers/Projects/CommentsController.php
+++ b/app/Http/Controllers/Projects/CommentsController.php
@@ -17,8 +17,10 @@ class CommentsController extends Controller
*/
public function index(Project $project)
{
+ $this->authorize('view-comments', $project);
+
$editableComment = null;
- $comments = $project->comments()->latest()->paginate();
+ $comments = $project->comments()->with('creator')->latest()->paginate();
if (request('action') == 'comment-edit' && request('comment_id') != null) {
$editableComment = Comment::find(request('comment_id'));
@@ -36,7 +38,7 @@ class CommentsController extends Controller
*/
public function store(Request $request, Project $project)
{
- $this->authorize('view', $project);
+ $this->authorize('comment-on', $project);
$newComment = $request->validate([
'body' => 'required|string|max:255',
@@ -62,6 +64,8 @@ class CommentsController extends Controller
*/
public function update(Request $request, Project $project, Comment $comment)
{
+ $this->authorize('update', $comment);
+
$commentData = $request->validate([
'body' => 'required|string|max:255',
]);
diff --git a/resources/views/projects/comments.blade.php b/resources/views/projects/comments.blade.php
index d2ebabe..991bead 100755
--- a/resources/views/projects/comments.blade.php
+++ b/resources/views/projects/comments.blade.php
@@ -36,6 +36,12 @@
@endif
@endsection
+@section('ext_css')
+
+@endsection
+
@section('script')