openvk/Web/Presenters/ContentSearchPresenter.php

24 lines
552 B
PHP
Raw Permalink Normal View History

2020-06-07 19:04:43 +03:00
<?php declare(strict_types=1);
namespace openvk\Web\Presenters;
use openvk\Web\Models\Repositories\ContentSearchRepository;
final class ContentSearchPresenter extends OpenVKPresenter
{
private $repo;
function __construct(ContentSearchRepository $repo)
{
$this->repo = $repo;
}
function renderIndex(): void
{
if($_SERVER["REQUEST_METHOD"] === "POST")
{
$this->template->results = $repo->find([
"query" => $this->postParam("query"),
]);
}
}
}