Specify routes in Laravel 5.5

0

I'm doing a draft of a page starting with making the routes.

These are the routes so far:

Route::get('/', function () {
  return view('inicio');
});

Route::get('instituto', function () {
return view('instituto');
});

This is the layout:          

Encabezado
<br>
@yield('content')
<br>

Pie de pagina 

This is the home page:     @extends ('layout')

@section('content')

Esto es el inicio
<a href="{{ route('instituto')}}">instituto</a>


@endsection

This is the institute:     @extends ('layout')

@section('content')

instituto

@endsection

This is my views folder:

I get this error: "Route [instituto] not defined.

    
asked by Kinafune 11.02.2018 в 22:24
source

1 answer

0

The error is simple, when creating the path in Laravel the name is not automatically assigned at least a path type resource to be able to reference from the view, so you must do it manually as follows.

Route::get('instituto', function () {
    return view('instituto');
})->name('instituto'); //asignamos el nombre con el que hacemos referencia desde la vista
    
answered by 11.02.2018 / 23:02
source