Browse Source

Add issue comments count on issue index page

pull/37/head
Nafies Luthfi 7 years ago
parent
commit
803e1edaef
  1. 5
      app/Http/Controllers/Projects/IssueController.php
  2. 2
      resources/views/projects/issues/index.blade.php

5
app/Http/Controllers/Projects/IssueController.php

@ -15,7 +15,10 @@ class IssueController extends Controller
{
public function index(Project $project)
{
$issues = $project->issues()->with(['pic', 'creator'])->get();
$issues = $project->issues()
->with(['pic', 'creator'])
->withCount(['comments'])
->get();
return view('projects.issues.index', compact('project', 'issues'));
}

2
resources/views/projects/issues/index.blade.php

@ -19,6 +19,7 @@
<th>{{ __('issue.title') }}</th>
<th>{{ __('issue.priority') }}</th>
<th>{{ __('app.status') }}</th>
<th class="text-center">{{ __('comment.comment') }}</th>
<th>{{ __('issue.pic') }}</th>
<th>{{ __('issue.creator') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
@ -33,6 +34,7 @@
<td>{{ $issue->title }}</td>
<td>{!! $issue->priority_label !!}</td>
<td>{!! $issue->status_label !!}</td>
<td class="text-center">{{ $issue->comments_count }}</td>
<td>{{ $issue->pic->name }}</td>
<td>{{ $issue->creator->name }}</td>
<td class="text-center">

Loading…
Cancel
Save