how can I redirect to a route

1

Good I want that when clicking on a button I redirect to another tab using laravel with the blade technology

Route::get('home', function() {
    return view('onepage.home');
});

is my route.!

<ul>
    <li><a  href =" ">how it works</a></li>
</ul>
    
asked by merwil vegas 06.09.2018 в 02:37
source

2 answers

3

A serious way of putting the link

<a href="{{ url('/home') }}">Home</a>

Another way would be serious if you have a controller resource serious

<a href="route('usuario.create') }}">Crear usuario</a>
    
answered by 06.09.2018 в 05:24
0

I would recommend that you give your route an alias with the name() method since if your route is now called "home" but after you want it to be called "home", you should not change any file other than the of routes.

Route::get('home', function() {
    return view('onepage.home');
})->name('home');

To obtain the aliased route, use the route()

method
<ul>
    <li><a href="{{ route('home') }}">how it works</a></li>
</ul>

If afterwards you want your url to be called "start" you just have to change the file of your routes:

Route::get('inicio', function() {
        return view('onepage.home');
    })->name('home');
    
answered by 06.09.2018 в 18:35