Today, We want to share with you Laravel 6 Redirect Function.In this post we will show you Laravel 6 Redirect to URL using redirect() helper, hear for Learn about Laravel 6 Auth Redirection using redirectTo we will give you demo and example for implement.In this post, we will learn about Laravel 6 redirect back to original destination after login with an example.
Laravel 6 Redirect Function
There are the Following The simple About Redirect with Flashed Session Data Full Information With Example and source code.
As I will cover this Post with live Working example to develop Redirect to Named Routes with parameters, so the Redirect to Named Routes with parameters is used for this example is following below.
Laravel 6 Redirect to URL
Route::get('tamilrokers/movies', 'ListController@movies');
Controller Method:
public function list() { return redirect('tamilrokers/movies'); }
Redirect back to previous page in Laravel 6
public function list() { return back(); } OR public function list2() { return redirect()->back(); }
Laravel 6 Redirect to Named Routes
Route::get('tamilrokers/movies', array('as'=> 'tamilrokers.movies', 'uses' => 'ListController@movies'));
Laravel 6 Controller Method:
public function list() { return redirect()->route('tamilrokers.movies'); }
Redirect to Named Routes with parameters using Laravel 6
using Laravel 6 Route:
Route::get('tamilrokers/movie/{id}', array('as'=> 'tamilrokers.movie', 'uses' => 'ListController@movies'));
Controller Method:
public function list() { return redirect()->route('tamilrokers.movie',['id'=>89]); }
Laravel 6 Redirect to Controller Action
public function list() { return redirect()->action('App\Http\Controllers\ListController@list'); }
Redirect to Controller Action With Parameters
public function list() { return redirect()->action('App\Http\Controllers\ListController@list',['id'=>89]); }
Redirect with Flashed Session Data with Laravel 6
public function list() { return redirect('list')->with('message', 'Welcome to TamilRokers Website free Download source code Laravel 6.2 Projects Tutorials!'); }
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about Redirect back to previous page.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.