openvk/Web/Presenters/ContentSearchPresenter.php

27 lines
574 B
PHP
Raw Permalink Normal View History

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