I just started an laravel 5.2 application. Every route I take (/register, /logout, login,...) redirects me to the homepage.
Here are my routes
<?php
Route::group(['middleware' => ['web']], function () {
//Register
Route::get('/register', 'Auth\AuthController@getRegister');
Route::get('/register/success', 'Auth\AuthController@getRegisterSuccess');
Route::post('/register', 'Auth\AuthController@PostRegister');
//Login
Route::get('/login', 'Auth\AuthController@getLogin');
Route::post('/login', 'Auth\AuthController@PostLogin');
//Password Reset
Route::get('/password/reset/email', 'Auth\PasswordController@getEmail');
Route::get('/password/reset/{token}', 'Auth\PasswordController@getToken');
Route::get('/password/reset/sent', 'Auth\PasswordController@getSent');
Route::post('/password/reset/email', 'Auth\PasswordController@postEmail');
Route::post('/password/reset', 'Auth\PasswordController@postReset');
});
Route::group(['middleware' => ['web', 'auth']], function () {
Route::get('/logout', 'Auth\AuthController@getLogout');
});
Route::get('/', function () {
return view('welcome');
});
when I remove the Route::group(['middleware' => ['web']], function () {
line I can access the page but it gives me the error of
Undefined variable: errors
That's why the web middelware is required, So I'm kinda stuck.
The controller and views work. It's just this redirect that I can't figure out.
Thanks for your help!
You need to make changes in your AuthController and put where do you want to be redirected.
Then you need to add this in every controller you have:
You have to make a blade template like auth.blade.php in resources/views. Then you need to make the view from your controller with a return like: