diff --git a/app/Http/Controllers/CoureseAssignController.php b/app/Http/Controllers/CoureseAssignController.php
new file mode 100644
index 0000000..6a4f58e
--- /dev/null
+++ b/app/Http/Controllers/CoureseAssignController.php
@@ -0,0 +1,46 @@
+with('error', 'Please login first!');
+ }
+
+
+ $student = DB::table('student_details')
+ ->where('student_portal_log_id', $studentLogId)
+ ->orWhere('student_id', $studentId)
+ ->first();
+
+ if (!$student) {
+ return redirect()->back()->with('error', 'Student record not found!');
+ }
+
+
+ $course = DB::table('courses')
+ ->join('course_assign_student', 'courses.id', '=', 'course_assign_student.course_id')
+ ->where('course_assign_student.student_details_id', $student->id)
+ ->select('courses.*')
+ ->first();
+
+
+ return view('mycourse', compact('course', 'student'));
+ }
+
+ public function showModule($id)
+ {
+
+ return view('module', ['moduleId' => $id]);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/ResultsController.php b/app/Http/Controllers/ResultsController.php
index 9440ca1..801071d 100644
--- a/app/Http/Controllers/ResultsController.php
+++ b/app/Http/Controllers/ResultsController.php
@@ -9,18 +9,18 @@ class ResultsController extends Controller
{
public function index()
{
- // 1. Session එකෙන් ID එක ලබා ගැනීම
+
$studentLogId = session('student_log_id') ?? session('student_id');
- // Session එකේ ID එකක් නොමැති නම් Login එකට Redirect කිරීම
+
if (!$studentLogId) {
return redirect('/signin')->with('error', 'Please login first!');
}
- // 2. Log වී සිටින Student ගේ student_log_id එකට අදාළව දත්ත ලබා ගැනීම
+
$results = Result::where('student_log_id', $studentLogId)->get();
- // 3. Calculations
+
$totalModules = $results->count();
$passedModules = $results->filter(function ($item) {
@@ -29,7 +29,7 @@ class ResultsController extends Controller
$averageMarks = $totalModules > 0 ? round($results->avg('marks'), 1) : 0;
- // View එකට Data Pass කිරීම
+
return view('results', compact('results', 'totalModules', 'passedModules', 'averageMarks'));
}
}
\ No newline at end of file
diff --git a/app/Http/Controllers/TimetableController.php b/app/Http/Controllers/TimetableController.php
index 8638320..7b49797 100644
--- a/app/Http/Controllers/TimetableController.php
+++ b/app/Http/Controllers/TimetableController.php
@@ -10,22 +10,20 @@ class TimetableController extends Controller
{
public function index()
{
- // Session Check
+
$studentLogId = session('student_log_id') ?? session('student_id');
if (!$studentLogId) {
return redirect('/signin')->with('error', 'Please login first!');
}
- // 1. All Timetable Records Get
- // (තනි Student ට අදාළ දත්ත හෝ පොදු Timetable දත්ත)
+
$rawTimetables = Timetable::whereNull('student_log_id')
->orWhere('student_log_id', $studentLogId)
->orderBy('sort_order', 'asc')
->get();
- // Data එක Table එකට ලෙහෙසියෙන් Group කර ගැනීම
- // Array structure: $schedule[TimeSlot][Day] = Item
+
$schedule = [];
$timeSlots = [];
@@ -36,8 +34,8 @@ class TimetableController extends Controller
$schedule[$item->time_slot][$item->day] = $item;
}
- // 2. Today's Schedule (අද දවසේ පන්ති පමණක් ලබා ගැනීම)
- $todayName = Carbon::now()->format('l'); // Monday, Tuesday etc.
+
+ $todayName = Carbon::now()->format('l');
$todaySchedule = Timetable::where('day', $todayName)
->where(function($q) use ($studentLogId) {
$q->whereNull('student_log_id')
diff --git a/app/Models/courses.php b/app/Models/courses.php
index b5d4bd3..b6da5ad 100644
--- a/app/Models/courses.php
+++ b/app/Models/courses.php
@@ -27,4 +27,14 @@ class courses extends Model
'course_code',
'status'
];
+
+ public function students()
+ {
+ return $this->belongsToMany(
+ StudentDetail::class,
+ 'course_assign_student',
+ 'course_id',
+ 'student_details_id'
+ );
+ }
}
\ No newline at end of file
diff --git a/database/migrations/2026_08_04_052344_create_results_table.php b/database/migrations/2026_08_04_052344_create_results_table.php
index 5c3268d..2986821 100644
--- a/database/migrations/2026_08_04_052344_create_results_table.php
+++ b/database/migrations/2026_08_04_052344_create_results_table.php
@@ -19,8 +19,8 @@ return new class extends Migration
$table->string('semester');
$table->string('module_name');
$table->integer('marks');
- $table->string('grade'); // e.g., 'A+', 'A', 'B', 'C', 'F'
- $table->string('status')->default('Pass'); // 'Pass' or 'Fail'
+ $table->string('grade');
+ $table->string('status')->default('Pass');
$table->timestamps();
});
}
diff --git a/database/migrations/2026_08_05_044438_create_timetables_table.php b/database/migrations/2026_08_05_044438_create_timetables_table.php
index 3c1adaf..7b9c0c2 100644
--- a/database/migrations/2026_08_05_044438_create_timetables_table.php
+++ b/database/migrations/2026_08_05_044438_create_timetables_table.php
@@ -13,7 +13,7 @@ return new class extends Migration
{
Schema::create('timetables', function (Blueprint $table) {
$table->id();
- $table->unsignedBigInteger('student_log_id')->nullable(); // Student-specific Timetable එකක් නම්
+ $table->unsignedBigInteger('student_log_id')->nullable();
$table->string('time_slot');
$table->string('day');
$table->string('subject_name');
diff --git a/resources/views/module.blade.php b/resources/views/module.blade.php
new file mode 100644
index 0000000..748245c
--- /dev/null
+++ b/resources/views/module.blade.php
@@ -0,0 +1,219 @@
+@extends('layouts.studentportalnav')
+
+@section('title', 'Module Details')
+
+@section('content')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Overview & Description
+
+ In this module, you will explore the essential foundational topics. We will cover step-by-step concepts to help you build a strong understanding before moving on to the advanced practical modules.
+
+
+
+
+
Resources & Downloads
+
+
+
+
+
+
+ Previous Module
+
+
+ Next Module
+
+
+
+
+
+
+
+
+
+
+ Course Playlist
+
+
+
+
+
+
+
+ 1. Introduction to Course
+
+ 10 mins
+
+
+
+
+ 2. Core Concepts Explained
+
+ 15 mins
+
+
+
+
+ 3. Practical Application
+
+ 20 mins
+
+
+
+
+ 4. Summary & Quiz
+
+ Locked
+
+
+
+
+
+
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/resources/views/mycourse.blade.php b/resources/views/mycourse.blade.php
index 66e7ad4..b02a907 100644
--- a/resources/views/mycourse.blade.php
+++ b/resources/views/mycourse.blade.php
@@ -189,197 +189,170 @@ body {
border-radius: 2px;
}
-/* Responsive Media Queries */
@media (min-width: 768px) {
- .main-portal-content {
- padding: 10px;
- }
- .hero {
- padding: 40px;
- }
- .course-card img {
- height: 280px;
- }
+ .main-portal-content { padding: 10px; }
+ .hero { padding: 40px; }
+ .course-card img { height: 280px; }
}
-
-
-
-
-
Diploma in Automotive Engineering
-
Welcome back! Continue your learning journey and complete all modules.
-
- Continue Learning
-
-
-
-
+ @if($course)
+
+ {{-- Dynamic Image URL Handler --}}
+ @php
+ $imageSrc = Str::startsWith($course->image, ['http://', 'https://'])
+ ? $course->image
+ : asset('storage/' . $course->image);
+ @endphp
+
+
+
+
+
+
{{ $course->title }}
+
Welcome back! Continue your learning journey and complete all modules.
+
+ Continue Learning
+
+
+
+
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
AE101
-
- Automotive Engineering Department
-
+
+
+
+
+
+
+
+
+
+
{{ $course->course_code ?? $course->title }}
+
+ {{ $course->author ?? 'Instructor' }}
+
+
+
+ {{ $course->badge ?? 'Active Course' }}
+
-
Diploma
-
-
- Master engine diagnostics, suspension systems, transmission technology, electrical systems, and hybrid vehicle maintenance through hands-on training and theoretical modules.
-
+
+ {{ $course->desc ?? 'No description available for this course.' }}
+
-
-
- Overall Progress
- 55%
-
-
-
+
+
+ Overall Progress
+ 0%
+
+
+
+
+
+
+ Course Modules
+
+
+
+
+
+
+
+
+
+
+
Introduction & Fundamentals
+ In Progress
+
+
Basic concepts and core theories.
+
+
+
+ Continue Learning
+
+
+
+
+
+
+
-
-
-
- Course Modules
-
-
-
-
-
-
-
-
-
-
-
-
Engine Fundamentals
- Completed
-
-
Learn engine parts and working principles.
-
-
-
Review Module
+
+
+
+
+
+
+
+
{{ $course->level ?? 'General' }}
+ Course Level
-
-
-
-
-
-
-
-
Transmission Systems
- In Progress
-
-
Manual & Automatic transmission systems.
-
-
-
Continue Learning
+
+
+
+
+
{{ $course->duration ?? 'N/A' }}
+ Course Duration
-
-
-
-
-
-
-
-
Brake Systems
- Locked
-
-
Complete previous module to unlock.
-
-
- Locked
-
-
-
-
-
-
-
-
-
-
-
-
Hybrid Technology
- Locked
-
-
Learn EV and Hybrid systems.
-
-
-
Locked
+
+
+
+
+
{{ $course->status ?? 'Enrolled' }}
+ Status
-
+
-
-
-
-
-
-
-
-
12
- Modules Available
-
-
-
+ @else
-
-
-
-
-
2 Years
- Course Duration
-
-
-
-
-
-
-
-
-
NVQ Level 5
- Qualification
-
-
+
+
+
+
+
+
No Assigned Course Found
+
You do not have any course assigned to your profile yet. Please contact the administration for assistance.
-
+ @endif
+
+
@endsection
\ No newline at end of file
diff --git a/resources/views/results.blade.php b/resources/views/results.blade.php
index 795fa6c..e0b0a0a 100644
--- a/resources/views/results.blade.php
+++ b/resources/views/results.blade.php
@@ -336,7 +336,7 @@ Download Card
-
+
@@ -396,7 +396,7 @@ function generatePDF() {
const element = document.getElementById('pdf-download-area');
const button = document.getElementById('download-pdf-btn');
- // Button status change while generating
+
button.disabled = true;
button.innerHTML = ' Generating PDF...';
@@ -408,7 +408,7 @@ function generatePDF() {
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
};
- // Generate PDF and restore button state
+
html2pdf().set(options).from(element).save().then(() => {
button.disabled = false;
button.innerHTML = ' Download PDF';
diff --git a/routes/web.php b/routes/web.php
index 2501903..4ea67fe 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -10,7 +10,10 @@ use App\Http\Controllers\Auth\ForgotPasswordController;
use App\Http\Controllers\coursesController;
use App\Http\Controllers\ApplyController;
use App\Http\Controllers\ResultsController;
-use App\Http\Controllers\TimetableController; // 1. TimetableController එක Import කළා
+use App\Http\Controllers\TimetableController;
+use App\Http\Controllers\CoureseAssignController;
+
+
/*
|--------------------------------------------------------------------------
@@ -121,4 +124,8 @@ Route::middleware(['web'])->group(function () {
Route::get('/Feedback&Complain', [FeedbackController::class, 'index'])->name('feedback.index');
Route::post('/Feedback&Complain/store', [FeedbackController::class, 'store'])->name('feedback.store');
+
+ Route::get('/mycourse', [CoureseAssignController::class, 'showMyCourse'])->name('mycourse');
+
+ Route::get('/module/{id}', [CoureseAssignController::class, 'showModule'])->name('module.show');
});
\ No newline at end of file