File: D:/HostingSpaces/SBogers10/zuiderbos.komma.pro/Komma/Search/SearchController.php
<?php
namespace Komma\Search;
use Komma\Kms\Schools\School;
use Komma\Pages\PageService;
use Nqxcode\LuceneSearch\Search;
class SearchController extends \BaseController
{
protected $pageService;
protected $searchService;
public function __construct(PageService $pageService, SearchService $searchService)
{
parent::__construct();
$this->pageService = $pageService;
$this->searchService = $searchService;
}
public function show($school)
{
$page = $this->pageService->getPageByRoute($school);
$page->root = $page;
$page->school = School::where('type', $page->code_name)
->first();
//get all page links
$links = $this->pageService->getAllRoutes();
// Get search results
$results = $this->searchService->getResults(\Input::get('q', null), $page->school);
return \View::make('layouts.pages.search')
->with('page', $page)
->with('results', $results)
->with('links', $links);
}
public function searchPages(){
$this->searchService->updateSearchTable();
}
}