Permalink
Browse files

Episode 98

  • Loading branch information...
JeffreyWay committed Nov 28, 2017
1 parent 7344c1a commit 088fc6680e5ec1e18afc236b8fd782c022a232f5
@@ -14,14 +14,11 @@ class SearchController extends Controller
*/
public function show(Trending $trending)
{
$threads = Thread::search(request('q'))->paginate(25);
if (request()->expectsJson()) {
return $threads;
return Thread::search(request('q'))->paginate(25);
}
return view('threads.index', [
'threads' => $threads,
return view('threads.search', [
'trending' => $trending->get()
]);
}
@@ -220,4 +220,14 @@ public function markBestReply(Reply $reply)
{
$this->update(['best_reply_id' => $reply->id]);
}
/**
* Get the indexable data array for the model.
*
* @return array
*/
public function toSearchableArray()
{
return $this->toArray() + ['path' => $this->path()];
}
}
@@ -72,6 +72,7 @@
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'key' => env('ALGOLIA_KEY', ''),
'secret' => env('ALGOLIA_SECRET', ''),
],

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -19,6 +19,7 @@
"dependencies": {
"at.js": "^1.5.3",
"jquery.caret": "^0.3.1",
"moment": "^2.18.1"
"moment": "^2.18.1",
"vue-instantsearch": "^1.3.2"
}
}
Oops, something went wrong.

0 comments on commit 088fc66

Please sign in to comment.