ResetPasswordController.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace App\Http\Controllers\AdminAuth;
  3. use App\Http\Controllers\Controller;
  4. use Illuminate\Foundation\Auth\ResetsPasswords;
  5. use Illuminate\Support\Facades\Auth;
  6. use Illuminate\Support\Facades\Password;
  7. use Illuminate\Http\Request;
  8. class ResetPasswordController extends Controller
  9. {
  10. /*
  11. |--------------------------------------------------------------------------
  12. | Password Reset Controller
  13. |--------------------------------------------------------------------------
  14. |
  15. | This controller is responsible for handling password reset requests
  16. | and uses a simple trait to include this behavior. You're free to
  17. | explore this trait and override any methods you wish to tweak.
  18. |
  19. */
  20. use ResetsPasswords;
  21. /**
  22. * Where to redirect users after login / registration.
  23. *
  24. * @var string
  25. */
  26. public $redirectTo = '/admin/home';
  27. /**
  28. * Create a new controller instance.
  29. *
  30. * @return void
  31. */
  32. public function __construct()
  33. {
  34. $this->middleware('admin.guest');
  35. }
  36. /**
  37. * Display the password reset view for the given token.
  38. *
  39. * If no token is present, display the link request form.
  40. *
  41. * @param \Illuminate\Http\Request $request
  42. * @param string|null $token
  43. * @return \Illuminate\Http\Response
  44. */
  45. public function showResetForm(Request $request, $token = null)
  46. {
  47. return view('admin.auth.passwords.reset')->with(
  48. ['token' => $token, 'email' => $request->email]
  49. );
  50. }
  51. /**
  52. * Get the broker to be used during password reset.
  53. *
  54. * @return \Illuminate\Contracts\Auth\PasswordBroker
  55. */
  56. public function broker()
  57. {
  58. return Password::broker('admins');
  59. }
  60. /**
  61. * Get the guard to be used during password reset.
  62. *
  63. * @return \Illuminate\Contracts\Auth\StatefulGuard
  64. */
  65. protected function guard()
  66. {
  67. return Auth::guard('admin');
  68. }
  69. }