Permalink
Browse files

Episode 95

  • Loading branch information...
JeffreyWay committed Nov 9, 2017
1 parent c6d0b76 commit 5fb2436797e539d38fb9bb896f548543b9c53f39
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use App\{Thread, Trending};
class SearchController extends Controller
{
/**
* Show the search results.
*
* @param \App\Trending $trending
* @return mixed
*/
public function show(Trending $trending)
{
$threads = Thread::search(request('q'))->paginate(25);
if (request()->expectsJson()) {
return $threads;
}
return view('threads.index', [
'threads' => $threads,
'trending' => $trending->get()
]);
}
}
@@ -6,10 +6,11 @@
use App\Filters\ThreadFilters;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
class Thread extends Model
{
use RecordsActivity;
use RecordsActivity, Searchable;
/**
* Don't auto-apply mass assignment protection.
@@ -6,9 +6,11 @@
"type": "project",
"require": {
"php": ">=5.6.4",
"algolia/algoliasearch-client-php": "^1.23",
"barryvdh/laravel-debugbar": "^2.3",
"kitetail/zttp": "^0.3.0",
"laravel/framework": "5.5.*",
"laravel/scout": "^3.0",
"laravel/tinker": "~1.0",
"predis/predis": "^1.1"
},
Oops, something went wrong.

0 comments on commit 5fb2436

Please sign in to comment.