src/Concerns/HasMiddleware.php
protected function pushMiddleware($middleware, string $key = "", string $group = null)
    {
        $middleware = $this->middlewareResolver()->resolveOrFail($middleware, $key);
        $this->getMiddlewareGroup($group ?: $this->middlewareGroupId)->put($key, $middleware);
        return $this;
    }
protected function pushMiddleware($middleware, string $key = "", string $group = null)
    {
        $middleware = $this->middlewareResolver()->resolveOrFail($middleware, $key);
        $this->getMiddlewareGroup($group ?: $this->middlewareGroupId)->put($key, $middleware);
        return $this;
    }
Add a new middleware to end of the stack if it does not already exist.

@param mixed $middleware
@param string $key
@param string|null $group
@return $this