0
My web.php file looks like this:
Route::get('/login', 'AutenticacaoController@login')->name('autenticacao.login');
Route::post('/logar', 'AutenticacaoController@logar')->name('autenticacao.logar');
Route::resource('autenticacao', 'AutenticacaoController');
Route::middleware(['auth'])->group(function(){
Route::get('/', 'MunicipioController@inicio')->name('inicio');
Route::get('/logout', 'AutenticacaoController@logout')->name('autenticacao.logout');
Route::resource('municipios', 'MunicipioController');
});
If I access the route localhost/login
, I can access it, but if I access it localhost/
, get the bug:
Route [login] not defined.
What could be wrong?
The idea is that when accessing localhost/
, be redirected to localhost/login
There was no shortage of creating a
middleware
to verify and redirect to this\login
? how you did your authentication form, also need to create route protection, the one that comes in the framework is an example and follows a pattern– novic
hi @virgilionovic I don’t know how to do. can you explain me? in the tutorial I’m following, the guy does similar to how I’m doing.
– Italo Rodrigo
Qual tutorial @Italo?
– novic
@Virgilionovic is a course of Latin on the site of devmedia. I posted the question there too, but I think the guy only answers Monday :/
– Italo Rodrigo
So maybe the guy blends what’s in Laravel with what he’s teaching. When I do that part, I mount my own middleware and my own login or logout route ... ! see I think any answer will get in your way (I think)
– novic
@Virgilionovic blz then. Still thanks for the tip
– Italo Rodrigo
Any help can get in the way of the course ... does not have a focus to answer accurately ... I know a way, but if the course the guy uses another ? will not lose focus !
– novic
In your route settings, you have set that you need to be logged in to access
localhost/
, and if it is not, Laravel automatically redirects to a route with thename
login by default. If you replace theautenticacao.login
forlogin
, I believe it will redirect correctly.– Vinicius Lourenço
really worked Vinicius worth it
– Italo Rodrigo
@Viniciuslourenço if you want, put the solution to earn the points
– Italo Rodrigo