What is reverse routing in Laravel?

devquora
devquora

Posted On: Apr 19, 2024

 

    1 Answer Written

  •  devquora
    Answered by devquora

    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.

     

Related Questions

Please Login or Register to leave a response.

Related Questions

Laravel Interview Questions

What is Laravel?

Laravel is a free open source "PHP framework" based on the MVC design pattern. It is created by Taylor Otwell...