diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index f8c360d..4c8011a 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -45,16 +45,14 @@ public function profilview(Request $request) 'password' => Hash::make($request->password), ]); - // Automatically logs the new user in + Auth::login($user); - // FIX: Changed redirect from '/signin' to '/' because they are already logged in + return redirect('/')->with('success', 'Registration successful! Welcome to your dashboard.'); } - /** - * Handle Student Login (POST) - */ + public function login(Request $request) { $credentials = $request->validate([ diff --git a/app/Http/Controllers/studentportalnavController.php b/app/Http/Controllers/studentportalnavController.php new file mode 100644 index 0000000..c74fdea --- /dev/null +++ b/app/Http/Controllers/studentportalnavController.php @@ -0,0 +1,23 @@ +session()->invalidate(); + $request->session()->regenerateToken(); + + + return response()->json([ + 'success' => true, + 'message' => 'Logged out successfully' + ]); + } +} diff --git a/app/Models/courses.php b/app/Models/courses.php new file mode 100644 index 0000000..b3a1479 --- /dev/null +++ b/app/Models/courses.php @@ -0,0 +1,10 @@ +id(); + $table->string('title'); + $table->string('image')->nullable(); + $table->string('duration'); + $table->string('level'); + $table->string('author'); + $table->longText('desc')->nullable(); + $table->integer('student')->default(0); + $table->decimal('rating', 3, 2)->default(0.00); + $table->string('badge')->nullable(); + $table->boolean('trending')->default(false); + $table->string('course_code')->unique(); + $table->string('status')->default('draft'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('courses'); + } +}; diff --git a/database/migrations/2026_07_15_101829_add_foreign_key_to_student_portal_logs_table.php b/database/migrations/2026_07_15_101829_add_foreign_key_to_student_portal_logs_table.php new file mode 100644 index 0000000..7007d8c --- /dev/null +++ b/database/migrations/2026_07_15_101829_add_foreign_key_to_student_portal_logs_table.php @@ -0,0 +1,33 @@ +foreignId('user_id') + ->nullable() + ->after('email') + ->constrained('users') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('student_portal_logs', function (Blueprint $table) { + $table->dropForeign(['user_id']); + $table->dropColumn('user_id'); + }); + } +}; diff --git a/database/migrations/2026_07_15_105209_add_student_portal_log_id_to_student_details_table.php b/database/migrations/2026_07_15_105209_add_student_portal_log_id_to_student_details_table.php new file mode 100644 index 0000000..e9e2423 --- /dev/null +++ b/database/migrations/2026_07_15_105209_add_student_portal_log_id_to_student_details_table.php @@ -0,0 +1,32 @@ +foreignId('student_portal_log_id') + ->nullable() + ->constrained('student_portal_logs') + ->onDelete('cascade'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('student_details', function (Blueprint $table) { + $table->dropForeign(['student_portal_log_id']); + $table->dropColumn('student_portal_log_id'); + }); + } +}; diff --git a/database/migrations/2026_07_15_110741_create_course_assign_student_table.php b/database/migrations/2026_07_15_110741_create_course_assign_student_table.php new file mode 100644 index 0000000..9bc61e8 --- /dev/null +++ b/database/migrations/2026_07_15_110741_create_course_assign_student_table.php @@ -0,0 +1,34 @@ +id(); + $table->foreignId('student_details_id') + ->constrained('student_details') + ->onDelete('cascade'); + + $table->foreignId('course_id') + ->constrained('courses') + ->onDelete('cascade'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('course_assign_student'); + } +}; diff --git a/resources/views/StudentPortal.blade.php b/resources/views/StudentPortal.blade.php index 0dc932d..bc93015 100644 --- a/resources/views/StudentPortal.blade.php +++ b/resources/views/StudentPortal.blade.php @@ -127,7 +127,7 @@ body{
Manage your academic activities from your dashboard.