public function addMiddleware($middleware, bool $prepend = false)
    {
        if (!is_array($middleware)) {
            $middleware = [$middleware];
        }

        if ($prepend) {
            $this->middleware = array_merge($middleware, $this->middleware);
        } else {
            $this->middleware = array_merge($this->middleware, $middleware);
        }

        $this->middleware = array_unique($this->middleware, SORT_REGULAR);
    }
public function addMiddleware($middleware, bool $prepend = false)
    {
        if (!is_array($middleware)) {
            $middleware = [$middleware];
        }

        if ($prepend) {
            $this->middleware = array_merge($middleware, $this->middleware);
        } else {
            $this->middleware = array_merge($this->middleware, $middleware);
        }

        $this->middleware = array_unique($this->middleware, SORT_REGULAR);
    }
public function addMiddleware ( $ middleware , bool $ prepend = false ) { if ( ! is_array ( $ middleware ) ) { $ middleware = [ $ middleware ] ; } if ( $ prepend ) { $ this -> middleware = array_merge ( $ middleware , $ this -> middleware ) ; } else { $ this -> middleware = array_merge ( $ this -> middleware , $ middleware ) ; } $ this -> middleware = array_unique ( $ this -> middleware , SORT_REGULAR ) ; }
Adds middleware to this route

@param string|array $middleware The middleware or list of middleware to add
@param bool $prepend True if we want to prepend the middleware (give them higher priority), otherwise false
Adds middleware to this route