FEATURE: add searching in content pages

This commit is contained in:
Michal Kváček
2016-03-14 23:25:07 +01:00
parent 8a94f1dbab
commit 72d00c8e64
6 changed files with 74 additions and 18 deletions
+5 -4
View File
@@ -2,6 +2,7 @@
namespace App\Handlers\Search;
use App\Handlers\Contracts\SearchHandler;
use App\Models\Content as ContentModel;
class Content implements SearchHandler
{
@@ -16,9 +17,9 @@ class Content implements SearchHandler
{
$token = '%' . $term . '%';
return Content::where('content', 'LIKE', $token)
->orWhere('description', 'LIKE', $token)
->orWhere('keywords', 'LIKE', $token)
return ContentModel::where('content', 'LIKE', $token)
->orWhere('meta_description', 'LIKE', $token)
->orWhere('meta_keywords', 'LIKE', $token)
->orWhere('title', 'LIKE', $token)
->orWhere('url', 'LIKE', $token)
->get();
@@ -31,6 +32,6 @@ class Content implements SearchHandler
public function getName()
{
return trans('...');
return trans('search.content');
}
}