如何制作自定义重定向功能(扩展重定向)? - Laravel 5.1

I'm trying to make a custom redirect function. I have created a custom route function in a new file (helpers.php) that works fine:

if (! function_exists('cms_route')) {
    /**
    * Generate a URL to a named route with predefined cms path.
    *
    * @param  string  $name
    * @param  array   $parameters
    * @param  bool    $absolute
    * @param  \Illuminate\Routing\Route  $route
    * @return string
    */
    function cms_route($name, $parameters = [], $absolute = true, $route = null)
    {
        return app('url')->route(config('constants.cms_path').'.'.$name, $parameters, $absolute, $route);
    }
}

I'm trying to call this function with redirect()->cms_route('name') instead of redirect()->route('name')

So when the cms path is changed everything keeps working.

How would I accomplish this?

Added as quick fix:

if (! function_exists('cms_redirect')) {
    /**
    * Get an instance of the redirector.
    *
    * @param  string  $name
    * @param  array   $parameters
    * @param  bool    $absolute
    * @param  \Illuminate\Routing\Route  $route
    * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
    */
    function cms_redirect($name, $parameters = [])
    {
        return redirect()->route(config('constants.cms_path').'.'.$name, $parameters);
    }
}