Faced such a problem: even after registration, or authorization, I still redirect from /home
to /login
. I’m fighting a problem for a long time and that I just didn’t try to do.
My routes
that action in auth:
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
HomeController:
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
//return view('home');
return redirect('users/{id}');
}
The fact is that I understand that the problem is in the constructor, but if you remove it, or make it empty, then nothing good will come of it, the user simply does not log in. Or when I change route
in middleware Authenticate.php
on 'home'
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('login');
}
}
I get endless redirect to /home
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire