Guest User

Untitled

a guest
Sep 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. class LoginController extends Controller
  2. {
  3.  
  4. protected $redirectTo = '/home';
  5.  
  6. protected function redirectTo()
  7. {
  8. if (Auth::check()) {
  9. $user_id = Auth::id();
  10. $usuario = users::where('id','=',$user_id)->first();
  11. if($usuario->hasRole('copy')){
  12. return redirect('/copy/dashboardCopy');
  13. }
  14. }
  15. }
  16.  
  17. /**
  18. * Create a new controller instance.
  19. *
  20. * @return void
  21. */
  22. public function __construct()
  23. {
  24. $this->middleware('guest', ['except' => 'logout']);
  25. }
  26. }
  27.  
  28. ...
  29. protected function redirectTo()
  30. {
  31. if(Auth::user()->hasRole('copy')){
  32. return '/copy/dashboardCopy';
  33. }
  34. }
  35. ...
  36.  
  37. class LoginController extends Controller
  38. {
  39. /*
  40. |--------------------------------------------------------------------------
  41. | Login Controller
  42. |--------------------------------------------------------------------------
  43. |
  44. | This controller handles authenticating users for the application and
  45. | redirecting them to your home screen. The controller uses a trait
  46. | to conveniently provide its functionality to your applications.
  47. |
  48. */
  49.  
  50. use AuthenticatesUsers;
  51.  
  52. /**
  53. * Where to redirect users after login.
  54. *
  55. * @var string
  56. */
  57. protected $redirectTo;
  58.  
  59. protected function redirectTo()
  60. {
  61. if(Auth::user()->hasRole('copy')){
  62. $this->redirectTo = '/copy/dashboardCopy';
  63. return $this->redirectTo;
  64. }
  65. }
  66.  
  67. /**
  68. * Create a new controller instance.
  69. *
  70. * @return void
  71. */
  72. public function __construct()
  73. {
  74. $this->middleware('guest', ['except' => 'logout']);
  75. }
  76. }
  77.  
  78. public $redirectTo = '/lender/home';
  79.  
  80. protected function redirectTo()
  81. {
  82. if(Auth::guard('lender')->check()){
  83. $this->redirectTo = '/lender/home';
  84. return $this->redirectTo;
  85. }
  86. }
Add Comment
Please, Sign In to add comment