AdminLoginController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use Auth;
  4. use App\Http\Controllers\Auth\LoginBaseController;
  5. class AdminLoginController extends LoginBaseController
  6. {
  7. /**
  8. * 重写 Where to redirect users after login.
  9. *
  10. * @var string
  11. */
  12. protected $redirectTo = '/admin';
  13. /**
  14. * 重写 Create a new controller instance.
  15. *
  16. * @return void
  17. */
  18. public function __construct()
  19. {
  20. $this->middleware('guest:admin')->except('logout');
  21. }
  22. /**
  23. * 重写 Show the application's login form.
  24. *
  25. * @return \Illuminate\Http\Response
  26. */
  27. public function showLoginForm()
  28. {
  29. return view('auth.admin_login');
  30. }
  31. /**
  32. * 重写 Get the guard to be used during authentication.
  33. *
  34. * @return \Illuminate\Contracts\Auth\StatefulGuard
  35. */
  36. protected function guard()
  37. {
  38. return Auth::guard('admin');
  39. }
  40. /**
  41. * 定义 操作认证数据库表名称
  42. *
  43. * @return string
  44. */
  45. public function usertable()
  46. {
  47. return TABLE_ADMINS;
  48. }
  49. /**
  50. * 定义 注销后重定向路径
  51. *
  52. * @return string
  53. */
  54. public function redirectToLogout()
  55. {
  56. return '/admin/login';
  57. }
  58. }