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
Contents
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', '[email protected]');
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' => '[email protected]'));
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' => '[email protected]'));
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\[email protected]'); }
Redirect to Controller Action With Parameters
public function list() { return redirect()->action('App\Http\Controllers\[email protected]',['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.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.