What is reverse routing in Laravel?

Sharad Jaiswal
Written by Sharad Jaiswal

Posted On: Sep 02, 2018

 

    1 Answer Written

  •  Sharad Jaiswal
    Posted by Sharad Jaiswal

    Laravel Reverse routing is the process of generating the URL based on name or symbol. It generates URL's based on route declarations. Reverse routing makes your application so much more flexible and helps the developer to write cleaner codes in View. It defines a relationship between links and Laravel routes. When a link is created by using names of existing routes, appropriate Uri's are created automatically by Laravel.

    // route declaration

    Route::get('login', 'users@login');

    Using reverse routing we can create a link to it and pass in any parameters that we have defined. Optional parameters, if not supplied, are removed from the generated link.

    {{ HTML::link_to_action('users@login') }}
    

    It will automatically generate an Url like http://xyz.com/login in view.

     

Please Login or Register to leave a response.

Related Questions

Ask a Question