Laravel 4: Redirect to a given url

后端 未结 5 1310
一生所求
一生所求 2020-12-25 10:28

Is there a method in Redirect class of laravel where the parameter is a complete url? We all know parameters to these methods are just route name,action, slash,..etc but wha

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-25 10:57

    You can use different types of redirect method in laravel -

    return redirect()->intended('http://heera.it');
    

    OR

    return redirect()->to('http://heera.it');
    

    OR

    use Illuminate\Support\Facades\Redirect;
    
    return Redirect::to('/')->with(['type' => 'error','message' => 'Your message'])->withInput(Input::except('password'));
    

    OR

    return redirect('/')->with(Auth::logout());
    

    OR

    return redirect()->route('user.profile', ['step' => $step, 'id' => $id]);
    

提交回复
热议问题