HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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();
    }

}