-
Notifications
You must be signed in to change notification settings - Fork 0
/
Controller.php
37 lines (30 loc) · 947 Bytes
/
Controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace app\core;
use app\core\middlewares\BaseMiddleware;
class Controller
{
public string $layout = 'main_layout'; //Default vrednost ce biti main_layout
public string $action = '';
/**
* @var array \app\core\middlewares\BaseMiddleware[]
*/
protected array $middleWares = [];
public function setLayout($layout) { //On ce nam prikazivati layout jer imamo layout sa korisnike koji su vec ulogovani i za one koji nisi, ono koji imaju neke privilegije i one koje nemaju
$this -> layout = $layout;
}
public static function render($view, $params = [])
{
return Application::$app -> view -> renderView($view, $params);
}
public function registerMiddleware(BaseMiddleware $middleware)
{
$this -> middleWares[] = $middleware;
}
/**
* @return array
*/
public function getMiddleWares(): array
{
return $this->middleWares;
}
}