add a post rule in route

@param string $name
@param string $path
@param string $controller
@return $this
338907
public function post($name, $path, $controller = null)
    {
        $this->add('POST', $name, $path, $controller);
        return $this;
    }
642115
public function route($name, $path, callable $callback)
    {
        // Modifying path from colon parameters /show/:id to bracket parameters /show/{id}
        $path = preg_replace("|(:(\w+))|", '{$2}', $path);

        // if the route is anonymous
        if (!$name) {
            $name = "N".uniqid();
        }

        $map = $this["router"]->getMap();
        $route = $map->route($name, $path, $callback);

        return $route;
    }
401264
public function createPathHeader($name, $path = null)
    {
        $header = new Swift_Mime_Headers_PathHeader($name, $this->emailValidator);
        if (isset($path)) {
            $header->setFieldBodyModel($path);
        }
        $this->setHeaderCharset($header);

        return $header;
    }
839607
public function options(string $name, string $path, $target, array $matchers = []) : self
    {
        $route = $this->createRoute([RequestMethodInterface::METHOD_OPTIONS], $name, $path, $target, $matchers);
        $this->addRoute($route);
        return $this;
    }
779661
public function addRoute(string $path, string $controller, string $action = 'index', string $method = Request::METHOD_GET) : self
    {
        $endPoint = new RouteEndpoint($this->namespace, $controller, $action, $method);
        $this->routes[] = new Route($path, $endPoint);
        
        return $this;
    }
1054063
protected function addFilters(Controller $controller, $action, Request $request, Route $route=null) {
		$controllerClass = get_class($controller);

		foreach($this->filters as $_filter) {
			$args = $_filter['args'];
			$filter = $_filter['filter'];

			if(isset($criteria)) {
				$criteria = $_filter['criteria'];
				if(isset($criteria['actions'])) {
					if(!is_string($action))
						continue;
					if($criteria['actions'] && strpos($controllerClass.':'.$action, $criteria['actions']) !== 0)
						continue;
				}
				if($route !== null && isset($criteria['route'])) {
					foreach($criteria['methods'] as $method) {
						if($criteria['route'] && strpos($route->getRoute(), $criteria['route']) !== 0 || strtoupper($method) !== $request->method())
							continue;
					}
				}
			}

			$reflector = new \ReflectionClass($filter);
			$controller->addFilter($reflector->newInstanceArgs($args));
		}

		foreach($this->beforeFilters as $_filter) {
			$filter = $_filter['filter'];

			if(isset($criteria)) {
				$criteria = $_filter['criteria'];
				if(isset($criteria['actions'])) {
					if(!is_string($action))
						continue;
					if($criteria['actions'] && strpos($controllerClass.':'.$action, $criteria['actions']) !== 0)
						continue;
				}
				if($route !== null && isset($criteria['route'])) {
					foreach($criteria['methods'] as $method) {
						if($criteria['route'] && strpos($route->getRoute(), $criteria['route']) !== 0 || strtoupper($method) !== $request->method())
							continue;
					}
				}
			}

			$controller->addBeforeFilter($filter);
		}

		foreach($this->afterFilters as $_filter) {
			$filter = $_filter['filter'];

			if(isset($criteria)) {
				$criteria = $_filter['criteria'];
				if(isset($criteria['actions'])) {
					if($criteria['actions'] && strpos($controllerClass.':'.$action, $criteria['actions']) !== 0)
						continue;
				}
				if($route !== null && isset($criteria['route'])) {
					foreach($criteria['methods'] as $method) {
						if($criteria['route'] && strpos($route->getRoute(), $criteria['route']) !== 0 || strtoupper($method) !== $request->method())
							continue;
					}
				}
			}

			$controller->addAfterFilter($filter);
		}
	}
861887
public function put(string $name, string $path, $target, array $matchers = []) : self
    {
        $route = $this->createRoute([RequestMethodInterface::METHOD_PUT], $name, $path, $target, $matchers);
        $this->addRoute($route);
        return $this;
    }
490677
protected function makeDirectory($controller, $path)
	{
		$directory = $this->getDirectory($controller);

		if ( ! $this->files->isDirectory($full = $path.'/'.$directory))
		{
			$this->files->makeDirectory($full, 0777, true);
		}
	}
324222
public function register( $name, $controller, array $options = [] )
	{
		if ( isset( $options['parameters'] ) && !isset( $this->parameters ) )
			$this->parameters = $options['parameters'];

		// If the resource name contains a slash, we will assume the developer wishes to
		// register these resource routes with a prefix so we will set that up out of
		// the box so they don't have to mess with it. Otherwise, we will continue.
		if ( Str::contains( $name, '/' ) )
		{
			$this->prefixedResource( $name, $controller, $options );

			return;
		}

		// We need to extract the base resource from the resource name. Nested resources
		// are supported in the framework, but we need to know what name to use for a
		// place-holder on the route parameters, which should be the base resources.
		$base = $this->getResourceWildcard( last( explode( '.', $name ) ) );

		$defaults = $this->resourceDefaults;

		foreach ( $this->getResourceMethods( $defaults, $options ) as $m )
			$this->{'addResource' . ucfirst( $m )}( $name, $base, $controller, $options );
	}
403104
protected function addResourceShow( $name, $base, $controller, $options )
	{
		$uri = $this->getResourceUri( $name ) . '/{' . $base . '';

		$action = $this->getResourceAction( $name, $controller, 'show', $options );

		return $this->router->get( $uri, $action );
	}
829210
public function addRoute($method, $path, $action)
    {
        $route = (new Route($this->conditions, $this->container))
            ->setMethods($method)
            ->setPath($path)
            ->setAction($action)
            ->setRouter($this);

        return $this->routes->add($route);
    }
378484
public function post(string $uri, string $controller, string $action)
    {
        $this->addRoute('POST', $uri, $controller, $action);
    }
1200021
public function register($name, $controller, array $options = array())
    {
        // If the resource name contains a slash, we will assume the developer wishes to
        // register these resource routes with a prefix so we will set that up out of
        // the box so they don't have to mess with it. Otherwise, we will continue.
        if (Str::contains($name, '/')) {
            $this->prefixedResource($name, $controller, $options);

            return;
        }

        // We need to extract the base resource from the resource name. Nested resources
        // are supported in the framework, but we need to know what name to use for a
        // place-holder on the route wildcards, which should be the base resources.
        $segments = explode('.', $name);

        $base = $this->getResourceWildcard(
            last($segments)
        );

        $methods = $this->getResourceMethods($this->resourceDefaults, $options);

        foreach ($methods as $method) {
            $method = 'addResource' .ucfirst($method);

            call_user_func(array($this, $method), $name, $base, $controller, $options);
        }
    }
485249
protected function registerInspected($route, $controller, $method, &$names)
    {
        $action = ['uses' => $controller.'@'.$method];
        // If a given controller method has been named, we will assign the name to the
        // controller action array, which provides for a short-cut to method naming
        // so you don't have to define an individual route for these controllers.
        $action['as'] = Arr::get($names, $method);
        $this->{$route['verb']}($route['uri'], $action);
    }
1082901
protected function prefixedResource( $name, $controller, array $options )
	{
		list( $name, $prefix ) = $this->getResourcePrefix( $name );

		// We need to extract the base resource from the resource name. Nested resources
		// are supported in the framework, but we need to know what name to use for a
		// place-holder on the route parameters, which should be the base resources.
		$callback = function ( $me ) use ( $name, $controller, $options )
		{
			$me->resource( $name, $controller, $options );
		};

		$this->router->group( compact( 'prefix' ), $callback );
	}
146046
protected function handleRouteRequirements($pathinfo, $name, Route $route)
    {
        $pathinfo = File::normalizePath($pathinfo, '/', false);
        $status = parent::handleRouteRequirements($pathinfo, $name, $route);

        if (self::REQUIREMENT_MATCH == $status[0] && 0 < count($route->getRequirements('HTTP-'))) {
            if (null === $request = $this->getContext()->getRequest()) {
                return array(self::REQUIREMENT_MISMATCH, null);
            }

            $requestMatcher = new RequestMatcher(null, null, null, null, array(), $route->getRequirements('HTTP-'));
            $status = array($requestMatcher->matches($request) ? self::REQUIREMENT_MATCH : self::REQUIREMENT_MISMATCH, null);
        }

        return $status;
    }
804476
public function controller($uri, $controller, $names = array())
	{
		$prepended = $controller;

		// First, we will check to see if a controller prefix has been registered in
		// the route group. If it has, we will need to prefix it before trying to
		// reflect into the class instance and pull out the method for routing.
		if (count($this->groupStack) > 0)
		{
			$prepended = $this->prependGroupUses($controller);
		}

		$routable = $this->getInspector()->getRoutable($prepended, $uri);

		// When a controller is routed using this method, we use Reflection to parse
		// out all of the routable methods for the controller, then register each
		// route explicitly for the developers, so reverse routing is possible.
		foreach ($routable as $method => $routes)
		{
			foreach ($routes as $route)
			{
				$this->registerInspected($route, $controller, $method, $names);
			}
		}

		$this->addFallthroughRoute($controller, $uri);
	}