diff --git a/app/Http/Controllers/StudentPortalController.php b/app/Http/Controllers/StudentPortalController.php new file mode 100644 index 0000000..da87fb4 --- /dev/null +++ b/app/Http/Controllers/StudentPortalController.php @@ -0,0 +1,44 @@ +validate([ + 'username' => 'required', + 'password' => 'required', + 'pin' => 'required|numeric', + ]); + + $student = DB::table('student_portal_logs') + ->where('email', $request->username) + ->first(); + + // 1. Hash::check පාවිච්චි කරලා password එක check කරන්න + if ($student && Hash::check($request->password, $student->password) && $student->pin == $request->pin) { + + // 2. Status එක active හෝ හිස් ("") වුණොත් ඇතුලට යන්න දෙන්න + if ($student->status !== 'active' && $student->status !== '') { + return redirect('/')->with('error', 'Your account is inactive!'); + } + + // Session එකට ID එක දානවා + $request->session()->put('student_id', $student->studentid); + + // කෙලින්ම Student Portal එකට redirect කරනවා + return redirect()->route('student.portal')->with('success', 'Logged in successfully!'); + } + + // දත්ත වැරදියි නම් හෝම් පේජ් එකට යවනවා + return redirect('/')->with('error', 'Invalid Email, Password, or PIN!'); +} +} diff --git a/app/Models/StudentPortalLog.php b/app/Models/StudentPortalLog.php new file mode 100644 index 0000000..5676927 --- /dev/null +++ b/app/Models/StudentPortalLog.php @@ -0,0 +1,25 @@ +id(); + $table->string('email'); + $table->string('studentid'); + $table->string('password'); + $table->integer('pin'); + $table->string('status'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('student_portal_logs'); + } +}; \ No newline at end of file diff --git a/resources/views/StudentPortal.blade.php b/resources/views/StudentPortal.blade.php new file mode 100644 index 0000000..968b026 --- /dev/null +++ b/resources/views/StudentPortal.blade.php @@ -0,0 +1,283 @@ + + +
+ + ++ Access your courses, timetable, assignments, examination results, + payments and profile from one place. +
+ + ++ Everything you need during your academic journey. +
+View enrolled courses and learning materials.
+Check your weekly lecture schedule.
+Submit assignments and download resources.
+View semester and final examination results.
+Pay course fees and download payment receipts.
+Update your personal information securely.
+{{ $course['desc'] }}
+