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

Laravel Route Optional Parameters

Today, We want to share with you Laravel Route Optional Parameters.In this post we will show you How to Use Parameters in Laravel Routes?, hear for Laravel 5.8 optional route parameters we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 – Routing to controller with optional parameters with an example.

Laravel Route Optional Parameters

There are the Following The simple About Route Optional Parameters using La-ravel 5.8 Full Information With Example and source code.

As I will cover this Post with live Working example to develop Handling route with multiple optional parameters, so the laravel route parameters controller for this example is following below.

  Facebook Graph Api GET User email address mobile birthday


Route::get('user/{name?}', function ($name = null) {
    return $name;

Route::get('user/{name?}', function ($name = 'John') {
    return $name;

Route::get('/datas/{id?}', '[email protected]');



namespace App\Http\Controllers;

use Auth;
use App;
use Mail;
use App\Mail\TestMail;

class TestController extends Controller

    public function getTest($id = null)
        dump("Hust : PAkainfo yes id = ".$id);



Route::get('/products/{product?}', function($product = null)
    // if product is set, show the product
    // if not, then show all
    if ($product)
        return 'This is the ' . $product . ' section.';
        return 'These are all the photos.';


Web Programming Tutorials Example with Demo

Read :


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

I hope you get an idea about Simple Route with Optional Parameters.
I would like to have feedback on my 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.

  Laravel 5.8 pdf create Download and Print