Search code examples
phpviewlaravel-5href

Can i return to a view from href tag in laravel without using controller?


I have a page home.blade.php.there is an href tag in this page which redirect to another page login.blade.php.

<a href="{{URL::to('login')}}">Login</a>.Any simple method to return to that page directly from this href tag?

Solution

  • Try this:

    You can redirect at any blade template via Route::get, without using a controller.

    In routes web.php

    Route::get('/login', function(){
        return view('login'); // Your Blade template name
    });