diff --git a/src/BBRouter/Route.php b/src/BBRouter/Route.php index 5ec7ac0..ab2515f 100755 --- a/src/BBRouter/Route.php +++ b/src/BBRouter/Route.php @@ -139,6 +139,7 @@ class Route{ //======================================================= function execute(){ + foreach ($this->_before as $key => $before){ if(!in_array($key, $this->_middlewares_to_ignore) ){ call_user_func($before); @@ -209,7 +210,7 @@ class Route{ } function middleware_ignore($name = ''){ - $this->_middlewares_to_ignore[$name]; + $this->_middlewares_to_ignore[] = $name; } function middleware_add($name = '', $function){ diff --git a/src/BBRouter/RouteCollection.php b/src/BBRouter/RouteCollection.php index a5a7a81..38bd44f 100755 --- a/src/BBRouter/RouteCollection.php +++ b/src/BBRouter/RouteCollection.php @@ -87,14 +87,14 @@ class RouteCollection{ private function define_verb(){ $verb = ''; - + if(isset($_POST['_method'])){ $verb = strtoupper( $_POST['_method'] ); }else if(php_sapi_name() == "cli"){ $verb = "CLI"; }else{ $verb = strtoupper( $_SERVER['REQUEST_METHOD'] ); - } + } if(in_array($verb, self::$_verbs_whitelist)){ $this->_verb = $verb;