From 3350b90866eedd920d087cc713bceb2798083452 Mon Sep 17 00:00:00 2001 From: imadhigp Date: Thu, 9 Jul 2026 17:04:06 +0530 Subject: [PATCH] fix7/9 --- .../Controllers/StudentPortalController.php | 44 +++ app/Models/StudentPortalLog.php | 25 ++ ...53111_create_student_portal_logs_table.php | 32 ++ resources/views/StudentPortal.blade.php | 283 ++++++++++++++++++ resources/views/courses.blade.php | 83 +++-- resources/views/layouts/app.blade.php | 9 +- resources/views/students.blade.php | 5 +- resources/views/welcome.blade.php | 1 + routes/web.php | 35 ++- 9 files changed, 455 insertions(+), 62 deletions(-) create mode 100644 app/Http/Controllers/StudentPortalController.php create mode 100644 app/Models/StudentPortalLog.php create mode 100644 database/migrations/2026_07_09_053111_create_student_portal_logs_table.php create mode 100644 resources/views/StudentPortal.blade.php 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 @@ + + + + + + Student Services - LMS Dashboard + + + + + + + + + + + +
+
+

Student Portal

+

+ Access your courses, timetable, assignments, examination results, + payments and profile from one place. +

+ + +
+
+ +
+
+
+

Student Services

+

+ Everything you need during your academic journey. +

+
+ +
+
+
+
+ +
+

My Courses

+

View enrolled courses and learning materials.

+
+
+ +
+
+
+ +
+

Class Timetable

+

Check your weekly lecture schedule.

+
+
+ +
+
+
+ +
+

Assignments

+

Submit assignments and download resources.

+
+
+ +
+
+
+ +
+

Exam Results

+

View semester and final examination results.

+
+
+ +
+
+
+ +
+

Fee Payments

+

Pay course fees and download payment receipts.

+
+
+ +
+
+
+ +
+

Student Profile

+

Update your personal information securely.

+
+
+
+
+
+ +
+
+
+

Quick Links

+
+ + +
+
+ + + \ No newline at end of file diff --git a/resources/views/courses.blade.php b/resources/views/courses.blade.php index def68b6..801ef54 100644 --- a/resources/views/courses.blade.php +++ b/resources/views/courses.blade.php @@ -71,7 +71,6 @@ background: var(--secondary); } -/* --- Udemy Style Course Card --- */ .course-card { border: 1px solid var(--card-border); border-radius: 20px; @@ -79,6 +78,7 @@ background: #fff; transition: transform 0.3s ease, box-shadow 0.3s ease; box-shadow: none; + scale: .99; } .course-card:hover { @@ -87,18 +87,18 @@ } .course-image-wrapper { - padding: 16px 16px 0 16px; + padding: 16px; } .course-card img { - height: 190px; + height: 200px; width: 100%; object-fit: cover; border-radius: 14px; } .course-card .card-body { - padding: 20px 24px 24px 24px; + padding: 24px; display: flex; flex-direction: column; } @@ -108,29 +108,19 @@ font-weight: 700; line-height: 1.3; color: #1c1d1f; - margin-bottom: 6px; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; - height: 55px; + margin-bottom: 8px; } .course-author { font-size: 14px; color: var(--text-muted); - margin-bottom: 8px; + margin-bottom: 12px; } .course-short-desc { font-size: 14px; color: #4f5357; - margin-bottom: 12px; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; - height: 42px; + margin-bottom: 16px; line-height: 1.5; } @@ -171,7 +161,7 @@ gap: 15px; font-size: 13px; color: var(--success-green); - margin-bottom: 18px; + margin-bottom: 20px; font-weight: 500; } @@ -369,33 +359,42 @@ $courses=[
@foreach($courses as $course) -
+
-
- {{ $course['title'] }} -
-
-

{{ $course['title'] }}

-
{{ $course['author'] }}
+
-

{{ $course['desc'] }}

+
+
+ {{ $course['title'] }} +
+
-
- {{ $course['badge'] }} - - {{ $course['rating'] }} - - ({{ $course['students'] }}) +
+
+

{{ $course['title'] }}

+
{{ $course['author'] }}
+ +

{{ $course['desc'] }}

+ +
+ {{ $course['badge'] }} + + {{ $course['rating'] }} + + ({{ $course['students'] }}) +
+ +
+ Practical Labs + Verified ({{ $course['duration'] }}) +
+ + +
-
- Practical Labs - Verified ({{ $course['duration'] }}) -
- -
@@ -412,7 +411,6 @@ $courses=[

Why Study With Us?

-
@@ -423,7 +421,6 @@ $courses=[
-
@@ -434,7 +431,6 @@ $courses=[
-
@@ -445,7 +441,6 @@ $courses=[
-
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index ed10445..a7ea045 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -13,7 +13,7 @@ body { font-family: 'Segoe UI', sans-serif; background: #f5f7fb; - /* 80px තිබුණු එක 56px කළා, එවිට අනවශ්‍ය space එක ඉවත් වේ */ + padding-top: 56px; } @@ -25,6 +25,7 @@ left: 0; width: 100%; box-shadow: 0 2px 10px rgba(0,0,0,0.1); + height: 83px; } .navbar-brand { @@ -41,12 +42,14 @@ color: rgba(255, 255, 255, 0.85) !important; margin-left: 20px; transition: 0.2s ease; - } + font-weight:bold; - /* දැනට ඉන්න පිටුව හෝ hover වන විට පැහැදිලිව පෙනීමට */ + } + .nav-link:hover, .nav-link.active-page { color: #ffc107 !important; + font-weight:bold; } .site-footer { diff --git a/resources/views/students.blade.php b/resources/views/students.blade.php index 7d10898..bbcbcae 100644 --- a/resources/views/students.blade.php +++ b/resources/views/students.blade.php @@ -289,7 +289,8 @@
-
+ + @csrf
diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 235083a..392175e 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -255,6 +255,7 @@ body{ .why-section i { color: #5E244E; } + {{-- ===================== HERO ===================== --}} diff --git a/routes/web.php b/routes/web.php index 0d27fc2..994800a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,8 +1,8 @@ name('student.login.submit'); +// Route::get('/student-login', [StudentPortalController::class, 'studentlogin'])->name('student.login.submit'); + + +Route::get('/student-portal', function () { + if (!session()->has('student_id')) { + return redirect()->back()->with('error', 'Please login first!'); + } + return view('StudentPortal'); +})->name('student.portal'); + +// Route::get('/student-logout', function () { +// session()->forget('student_id'); +// return redirect()->to('/students')->with('success', 'Logged out successfully!'); +// })->name('student.logout'); + -// Static Pages (Views) Route::view('/apply', 'apply')->name('apply'); Route::view('/courses', 'courses')->name('courses'); Route::view('/students', 'students')->name('students'); Route::view('/abouts', 'abouts')->name('abouts'); Route::view('/contact', 'contacts')->name('contact'); - Route::view('/signin', 'signin')->name('signin'); -Route::view('/signup', 'signup')->name('signup'); - - - - -// Route::get('/signup', function () { -// return view('signup'); -// })->name('signup'); \ No newline at end of file +Route::view('/signup', 'signup')->name('signup'); \ No newline at end of file