0
Good afternoon, everyone
Every time I go to another page my application asks to redo the login
Follows route
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::group(['prefix'=>'admin','middleware'=>'auth'], function(){
Route::get('/create', 'CreateController@create')->name('create');
Route::get('/query', 'CreateController@query')->name('query');
Route::get('/detalhes', ['as'=>'detalhes', 'uses'=> 'CreateController@detalhes']);
Route::get('/tarefas', ['as'=>'tarefas', 'uses'=> 'CreateController@tarefas']);
Route::post('/store', ['as'=>'store', 'uses'=> 'CreateController@store']);
Route::post('/delete', ['as' => 'delete' , 'uses' => 'CreateController@delete']);
Route::post('/alterar', ['as' => 'alterar' , 'uses' => 'CreateController@alterar']);
Route::post('/update', ['as' => 'update' , 'uses' => 'CreateController@update']);
});
Route::get('/home', 'HomeController@index')->name('home');
Home controller:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* CreateController a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');
}
}
I do not know specifically where the problem is yet, if you need more information forward
You are using middleware auth on all routes, this middleware makes all routes accessible only with logged in user.
– Kayo Bruno
So, this is the intention, that access is provided only to logged in users, the point is that if I am on the HOME page and click to go on the CREATE page it redirects me to the LOGIN page, however, I was already logged in.
– Rafael Balmant
Use this in your controller: echo '<pre>'; print_r( auth()->user() ); die; .
– Kayo Bruno
@Kayobruno Amigo already managed to solve the problem, it was a very basic thing,in one of my views was passing in a href={{ Auth::Logout() }}, and every time I reloaded the page this method was called, but thank you very much for the help :)
– Rafael Balmant