Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginController extends Controller
- {
- protected $redirectTo = '/home';
- protected function redirectTo()
- {
- if (Auth::check()) {
- $user_id = Auth::id();
- $usuario = users::where('id','=',$user_id)->first();
- if($usuario->hasRole('copy')){
- return redirect('/copy/dashboardCopy');
- }
- }
- }
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('guest', ['except' => 'logout']);
- }
- }
- ...
- protected function redirectTo()
- {
- if(Auth::user()->hasRole('copy')){
- return '/copy/dashboardCopy';
- }
- }
- ...
- class LoginController extends Controller
- {
- /*
- |--------------------------------------------------------------------------
- | Login Controller
- |--------------------------------------------------------------------------
- |
- | This controller handles authenticating users for the application and
- | redirecting them to your home screen. The controller uses a trait
- | to conveniently provide its functionality to your applications.
- |
- */
- use AuthenticatesUsers;
- /**
- * Where to redirect users after login.
- *
- * @var string
- */
- protected $redirectTo;
- protected function redirectTo()
- {
- if(Auth::user()->hasRole('copy')){
- $this->redirectTo = '/copy/dashboardCopy';
- return $this->redirectTo;
- }
- }
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('guest', ['except' => 'logout']);
- }
- }
- public $redirectTo = '/lender/home';
- protected function redirectTo()
- {
- if(Auth::guard('lender')->check()){
- $this->redirectTo = '/lender/home';
- return $this->redirectTo;
- }
- }
Add Comment
Please, Sign In to add comment