vendredi 5 octobre 2018

Laravel After Logging in is going to / Route

This is mine LoginController

 protected $redirectTo;
/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    if(Auth::check() && Auth::user()->role->id == 1){
        $this->redirectTo=route('admin.dashboard');
    }
    else{
        $this->redirectTo=route('user.dashboard');
      }

    $this->middleware('guest')->except('logout');
}

} Here is mine web.php

Route::get('/', function () {
    return view('welcome');
})->name('home');

Auth::routes();

I don't know Why after Successfully logging in its going to / route i want to send it to another route which after logging in i manually Enter the route i successfully viewed that route if i am logged in its not going to show but how can i manage after logging in route



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire