Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4. use App\Models\Student;
  5.  
  6. use Illuminate\Http\Request;
  7.  
  8. class StudentCheckController extends Controller
  9. {
  10.     /**
  11.      * Show form for student first time verification
  12.      */
  13.     public function index()
  14.     {
  15.         return view('frontend.auth-check');
  16.     }
  17.  
  18.     /**
  19.      * Check student against set  of questions
  20.      */
  21.     public function check(Request $request)
  22.     {
  23.         $student = Student::where('candidate_number', $request->input('candidate_number'))
  24.             ->where('date_of_birth', $request->input('dob'))
  25.             ->where('nok_phone_number', $request->input('nok_phone'))->first();
  26.  
  27.         if($student)
  28.         {  
  29.             return view('frontend.register', array('student' => $student));
  30.         }
  31.         else
  32.         {
  33.             return redirect()->route('check.verify')->withInput()
  34.                 ->withErrors(['head'=>'Verification Failed', 'body'=>'All your responses are supposed to be correct (to match records you supplied earlier)']);;
  35.         }
  36.        
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement