Laravel Redirect To Another URL / Web Page - HTTP Laravel Redirects

URL Redirect in Laravel Tutorial

Today, We want to share with you URL Redirect in Laravel Tutorial.In this post we will show you Laravel 5.8 Performing HTTP Redirects With redirect, hear for Laravel 5.8 Redirect to URL using redirect() helper we will give you demo and example for implement.In this post, we will learn about Redirect::route with parameter in URL in Laravel 5.8 with an example.

URL Redirect in Laravel Tutorial

There are the Following The simple About URL Redirect in Laravel Tutorial From Scratch Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel redirect to url with parameters, so the class ‘app\http\controllers\redirect’ not found for this example is following below.

Laravel Simple Redirect to URL

Laravel Define a Route:

Route::get('infinityknow/products', '[email protected]');

Laravel create a simple Controller Method:

public function shop()
{
    return redirect('infinityknow/products');
}

Redirect back to previous page

simple LAravel 5.8 Redirect back to previous page

public function shop()
{
    return back();
}

//OR

public function shop2()
{
    return redirect()->back();
}

Redirect to Named Routes

Laravel Define a Route:

Route::get('infinityknow/products', array('as'=> 'infinityknow.products', 'uses' => '[email protected]'));


Laravel Controller Method:
public function shop()
{
    return redirect()->route('infinityknow.products');
}

Laravel Redirect to Named Routes with parameters

Laravel Define a Route:

Route::get('infinityknow/product/{id}', array('as'=> 'infinityknow.product', 'uses' => '[email protected]'));


Laravel Controller Method:
public function shop()
{
    return redirect()->route('infinityknow.product',['id'=>17]);
}

Laravel Redirect to Controller Action

public function shop()
{
    return redirect()->action('App\Http\Controllers\[email protected]');
}

Laravel Redirect to Controller Action With Parameters

public function shop()
{
    return redirect()->action('App\Http\Controllers\[email protected]',['id'=>17]);
}

Laravel Redirect with Flashed Session Data

public function shop()
{
    return redirect('shop')->with('message', 'Welcome to infinityknow Tutorials!');
}

Web Programming Tutorials Example with Demo

Read :

  PHP Get Query String Parameters using Laravel

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about URL Redirect in Laravel Tutorial From Scratch.
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.

Leave a Reply

avatar
  Subscribe  
Notify of