Permalink
Browse files

Episode 62

  • Loading branch information...
JeffreyWay committed Aug 3, 2017
1 parent f269fc5 commit 261a84bde4019073ea4ff5a75a59c26699e34979
@@ -121,6 +121,6 @@ protected function getThreads(Channel $channel, ThreadFilters $filters)
$threads->where('channel_id', $channel->id);
}
return $threads->get();
return $threads->paginate(25);
}
}
@@ -0,0 +1,35 @@
@forelse ($threads as $thread)
<div class="panel panel-default">
<div class="panel-heading">
<div class="level">
<div class="flex">
<h4>
<a href="{{ $thread->path() }}">
@if (auth()->check() && $thread->hasUpdatesFor(auth()->user()))
<strong>
{{ $thread->title }}
</strong>
@else
{{ $thread->title }}
@endif
</a>
</h4>
<h5>
Posted By: <a href="{{ route('profile', $thread->creator) }}">{{ $thread->creator->name }}</a>
</h5>
</div>
<a href="{{ $thread->path() }}">
{{ $thread->replies_count }} {{ str_plural('reply', $thread->replies_count) }}
</a>
</div>
</div>
<div class="panel-body">
<div class="body">{{ $thread->body }}</div>
</div>
</div>
@empty
<p>There are no relevant results at this time.</p>
@endforelse
@@ -4,35 +4,9 @@
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
@forelse ($threads as $thread)
<div class="panel panel-default">
<div class="panel-heading">
<div class="level">
<h4 class="flex">
<a href="{{ $thread->path() }}">
@if (auth()->check() && $thread->hasUpdatesFor(auth()->user()))
<strong>
{{ $thread->title }}
</strong>
@else
{{ $thread->title }}
@endif
</a>
</h4>
@include ('threads._list')
<a href="{{ $thread->path() }}">
{{ $thread->replies_count }} {{ str_plural('reply', $thread->replies_count) }}
</a>
</div>
</div>
<div class="panel-body">
<div class="body">{{ $thread->body }}</div>
</div>
</div>
@empty
<p>There are no relevant results at this time.</p>
@endforelse
{{ $threads->render() }}
</div>
</div>
</div>
@@ -70,7 +70,7 @@ function a_user_can_filter_threads_by_popularity()
$response = $this->getJson('threads?popular=1')->json();
$this->assertEquals([3, 2, 0], array_column($response, 'replies_count'));
$this->assertEquals([3, 2, 0], array_column($response['data'], 'replies_count'));
}
/** @test */
@@ -81,7 +81,7 @@ function a_user_can_filter_threads_by_those_that_are_unanswered()
$response = $this->getJson('threads?unanswered=1')->json();
$this->assertCount(1, $response);
$this->assertCount(1, $response['data']);
}
/** @test */

0 comments on commit 261a84b

Please sign in to comment.