Laravel 5.2 route:cache更改了我的url()输出

I came accross a strange behavior from Laravel 5.2 and i would like to know if this happened to anyone else or only on my bad luck.

I have a function called optimize:

function optimize()
{
    $url = url('backend');
    \Artisan::call('route:cache');
    \Artisan::call('config:cache');

    return redirect()->to($url)->withMessage(_t('system_optimized'))->withMsgtype('success');

}

If i output the $url var then i get something like: http://devhost.dev/Cartaki/backend but if i output url('backend'); after the Artisan calls then i get something like this: http://devhost.dev/backend.

I solve this issue by using the $url var as a path to the redirect()->to() method but the problem is there.

Another strange thing is that my flash message will not show up after the redirection. If i comment out the artisan calls, then my flash message will show up as expected.

Any thoughts on this one?