validate([ 'username' => 'required', 'password' => 'required', 'pin' => 'required|numeric', ]); $student = DB::table('student_portal_logs') ->where('email', $request->username) ->first(); if ($student && Hash::check($request->password, $student->password) && $student->pin == $request->pin) { if ($student->status !== 'active' && $student->status !== '') { return redirect('/')->with('error', 'Your account is inactive!'); } $request->session()->put('student_id', $student->studentid); return redirect()->route('student.portal')->with('success', 'Logged in successfully!'); } return redirect('/')->with('error', 'Invalid Email, Password, or PIN!'); } }