FEATURE: add searching in content pages
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace App\Handlers\Search\Presenters;
|
||||
|
||||
use App\Handlers\Contracts\SearchPresenterHandler;
|
||||
|
||||
class AdminContent implements SearchPresenterHandler
|
||||
{
|
||||
public function render($foundItems)
|
||||
{
|
||||
return view('admin.content.overviewTiles', ['pages' => $foundItems, 'tileClass' => 'large-4']);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
namespace App\Handlers\Search\Presenters;
|
||||
|
||||
use App\Handlers\Contracts\SearchPresenterHandler;
|
||||
|
||||
class Content implements SearchPresenterHandler
|
||||
{
|
||||
public function render($foundItems)
|
||||
{
|
||||
var_dump($foundItems);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use App\Handlers\Registrators\SettingsExtensionRegistrator;
|
||||
use App\Handlers\Registrators\TemplateRegistrator;
|
||||
use App\Handlers\Registrators\WidgetRegistrator;
|
||||
use App\Handlers\Search\Content;
|
||||
use App\Handlers\Search\Presenters\Content as ContentPresenter;
|
||||
use App\Handlers\Search\Presenters\AdminContent as AdminContentPresenter;
|
||||
use App\Widgets\HtmlCode\HtmlCode;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -107,6 +107,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
$registrator = $this->app->make('registerSearchEngine');
|
||||
|
||||
$registrator->register(new Content(), new ContentPresenter());
|
||||
$registrator->register(new Content(), new AdminContentPresenter());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user