123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Http\Controllers\AuthSupervisor;
- use App\Http\Controllers\Controller;
- use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
- use Illuminate\Support\Facades\Password;
- use Illuminate\Http\Request;
- use App\User;
- class ForgotPasswordController extends Controller
- {
- /*
- |--------------------------------------------------------------------------
- | Password Reset Controller
- |--------------------------------------------------------------------------
- |
- | This controller is responsible for handling password reset emails and
- | includes a trait which assists in sending these notifications from
- | your application to your users. Feel free to explore this trait.
- |
- */
- use SendsPasswordResetEmails;
- public function __construct()
- {
- $this->middleware('teacher.guest');
- }
- public function showLinkRequestForm()
- {
- return view('auth_supervisor.passwords.email');
- }
- public function broker()
- {
- return Password::broker('users');
- }
- public function sendResetSupervisorLinkEmail(Request $request){
- $request->validate([
- 'email'=>'required|email|exists:users'
- ]);
- $supervisor= User::where('email', $request->email)->first();
- if (empty($supervisor)) {
- return back()->with('error','Unknown Email address!');
- }
- if($supervisor->apply_status == 0){
- return back()->with('error', 'Your account is still under review');
- }else{
- \Mail::to(
- $request->email
- )->send(
- new \App\Mail\SupervisorPasswordResetLink($supervisor)
- );
- return back()->with('success', 'Your password reset link sent to registered emails inbox.');
- }
-
- }
- }
|