如何在不添加基本URL的情况下重定向到laravel中的URL?

时间:2018-09-24 16:20:04

标签: php laravel

在Laravel中使用route('/ index',[],false),通过将第三个参数设置为url,我们可以获得相对路径。但是当我使用Redirect :: intended('/ dashboard')时,如何获得相对路径。现在它将/ dashboard添加到BASE_URL

1 个答案:

答案 0 :(得分:0)

Redirects
// Redirect to url
redirect('itsolution');
// Redirect to url with data
redirect('itsolution')->with('key', 'value');
// Redirect to url with input data
redirect('itsolution')->withInput(Input::get());
// Redirect to url with error
redirect('itsolution')->withErrors($validator);
// Redirect to back url
back()->withInput();

// Redirect to route url 
redirect()->route('login');
// For a route with the following URI: view/{id}
redirect()->route('view', ['id' => 1]);
// For a route with the following URI: view/{id}/edit/{id_sub}
redirect()->route('profile', [$user]);

// Redirect to controller method
redirect()->action('HomeController@index');
// Redirect to controller method with argument
redirect()->action('UserController@profile', ['id' => 1]);
// Response macro
response()->caps('foo');
// Redirect intend url
redirect()->intended('dashboard');
// Redirect back url
redirect()->back();