|
|
@@ -137,9 +137,16 @@ class Route {
|
|
|
|
|
|
//=======================================================
|
|
|
function execute() {
|
|
|
+ //Middlewares with function or class method
|
|
|
foreach ($this->_before as $key => $before) {
|
|
|
if (!in_array($key, $this->_middlewaresToIgnore) && !$this->_ignore) {
|
|
|
- call_user_func($before);
|
|
|
+ if (is_string($before)) {
|
|
|
+ $before = explode('@', $before);
|
|
|
+ $class = new $before[0]();
|
|
|
+ $class->{$before[1]}();
|
|
|
+ }else{
|
|
|
+ call_user_func($before);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|