App\Providers\RoutingServiceProvider::registerFixedMacro PHP Method

registerFixedMacro() protected method

Register Router Macro called Fixed fixed 로 호출할 수 있는 Router 매크로를 등록하여 플러그인 고유한 URL 을 가져갈 수 있도록 한다.
protected registerFixedMacro ( Router $router ) : void
$router Illuminate\Routing\Router to register macro
return void
    protected function registerFixedMacro(Router $router)
    {
        $fixedMacro = function ($key, Closure $callback, $routeOptions = null) {
            $newKey = str_replace('@', '/', $key);
            $attributes = ['prefix' => config('xe.routing.fixedPrefix') . '/' . $newKey];
            if ($routeOptions !== null and is_array($routeOptions)) {
                $routeOptions = array_except($routeOptions, ['prefix']);
                $attributes = array_merge($attributes, $routeOptions);
            }
            $this->group($attributes, $callback);
        };
        $router->macro('fixed', $fixedMacro);
    }