Atualizar 'src/BBRouter/Route.php'

This commit is contained in:
ahwelp
2019-03-07 04:42:34 +00:00
parent 4fed843f48
commit 5b974f1224
+9 -4
View File
@@ -139,13 +139,12 @@ class Route{
//=======================================================
function execute(){
foreach ($this->_before as $key => $before){
if(!in_array($key, $this->_middlewares_to_ignore) ){
if(!in_array($key, $this->_middlewares_to_ignore) && !$this->_ignore ){
call_user_func($before);
}
}
foreach ($this->_callback as $callback){
call_user_func_array($callback, $this->_params);
}
@@ -211,11 +210,17 @@ class Route{
function middleware_ignore($name = ''){
$this->_middlewares_to_ignore[] = $name;
return $this;
}
function middleware_add($name = '', $function){
function middleware_add($name = ''){
$this->_before[$name] = $function;
}
function middleware_append($name = '', $function){
$this->_before[$name] = $function;
}
function set_weight($weigth = 0){
$this->_weight = $weigth;