/**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $rollNo = Auth::guard('student')->user()->rollNo;
     if (StudentImage::find($rollNo) == null && !$request->session()->has('imageUploadSkipped')) {
         return redirect('/students/updateInfo/image');
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::guard('student')->check()) {
         $rollNo = Auth::guard('student')->user()->rollNo;
         if (StudentImage::find($rollNo) != null || $request->session()->has('imageUploadSkipped')) {
             return redirect('/students/home');
         }
     }
     return $next($request);
 }
 /**
  * Return the image of the student.
  *
  * @return mixed
  */
 public function getImage()
 {
     $rollNo = Auth::guard('student')->user()->rollNo;
     // Get the student image and return
     // it as http response
     $imageEntry = StudentImage::find($rollNo);
     if ($imageEntry != null) {
         $imagePath = $imageEntry->imagePath;
     } else {
         $imagePath = env('IMAGE_DIR') . 'circle.png';
     }
     $image = Image::make($imagePath);
     return $image->response();
 }