fix0715
This commit is contained in:
parent
2bd5825036
commit
6cfbe03314
|
|
@ -45,16 +45,14 @@ public function profilview(Request $request)
|
||||||
'password' => Hash::make($request->password),
|
'password' => Hash::make($request->password),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Automatically logs the new user in
|
|
||||||
Auth::login($user);
|
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.');
|
return redirect('/')->with('success', 'Registration successful! Welcome to your dashboard.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle Student Login (POST)
|
|
||||||
*/
|
|
||||||
public function login(Request $request)
|
public function login(Request $request)
|
||||||
{
|
{
|
||||||
$credentials = $request->validate([
|
$credentials = $request->validate([
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class studentportalnavController extends Controller
|
||||||
|
{
|
||||||
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
|
Auth::logout();
|
||||||
|
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true,
|
||||||
|
'message' => 'Logged out successfully'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class courses extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('courses', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('student_portal_logs', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('student_details', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('course_assign_student', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -127,7 +127,7 @@ body{
|
||||||
<div class="dashboard-header">
|
<div class="dashboard-header">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2>Welcome Back, <strong>{{ Auth::user()->first_name }}</strong></h2>
|
<h2>Welcome Back, student
|
||||||
<p>Manage your academic activities from your dashboard.</p>
|
<p>Manage your academic activities from your dashboard.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,9 +216,6 @@ body{
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -232,23 +232,23 @@ body {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
transition: transform 0.5s ease; /* Icon එක කැරකෙන්න transition එකක් දුන්නා */
|
transition: transform 0.5s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Card එක උඩට mouse එක ගෙනිච්චම වෙන වෙනස්කම් */
|
|
||||||
.feature-box:hover {
|
.feature-box:hover {
|
||||||
transform: translateY(-5px);
|
transform: translateY(-5px);
|
||||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
|
||||||
border-color: var(--primary);
|
border-color: var(--primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Card එක hover කරද්දී Icon එක අංශක 360ක් රොටේට් වෙන කොටස */
|
|
||||||
.feature-box:hover .feature-icon-wrapper i {
|
.feature-box:hover .feature-icon-wrapper i {
|
||||||
transform: rotate(360deg);
|
transform: rotate(360deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-icon-wrapper i {
|
.feature-icon-wrapper i {
|
||||||
transition: transform 0.5s ease; /* Smooth rotate වෙන්න */
|
transition: transform 0.5s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.feature-box h5 {
|
.feature-box h5 {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
<title>Responsive Student Portal</title>
|
<title>Responsive Student Portal</title>
|
||||||
|
|
||||||
<!-- Font Awesome Icons -->
|
<!-- Font Awesome Icons -->
|
||||||
|
|
@ -255,7 +256,7 @@
|
||||||
|
|
||||||
|
|
||||||
<nav class="nav">
|
<nav class="nav">
|
||||||
<a href="/Dashboard" class="nav-link active">
|
<a href="/Dashboard" class="nav-link ">
|
||||||
<i class="fa-solid fa-gauge"></i>Dashboard
|
<i class="fa-solid fa-gauge"></i>Dashboard
|
||||||
</a>
|
</a>
|
||||||
<a href="/mycourse" class="nav-link">
|
<a href="/mycourse" class="nav-link">
|
||||||
|
|
@ -264,9 +265,9 @@
|
||||||
<a href="/timetable" class="nav-link">
|
<a href="/timetable" class="nav-link">
|
||||||
<i class="fa-solid fa-calendar-days"></i>Class Timetable
|
<i class="fa-solid fa-calendar-days"></i>Class Timetable
|
||||||
</a>
|
</a>
|
||||||
<a href="/Assignments" class="nav-link">
|
<!-- <a href="/Assignments" class="nav-link">
|
||||||
<i class="fa-solid fa-file-lines"></i>Assignments
|
<i class="fa-solid fa-file-lines"></i>Assignments
|
||||||
</a>
|
</a> -->
|
||||||
<a href="/results" class="nav-link">
|
<a href="/results" class="nav-link">
|
||||||
<i class="fa-solid fa-square-poll-vertical"></i>Exam Results
|
<i class="fa-solid fa-square-poll-vertical"></i>Exam Results
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -283,6 +284,7 @@
|
||||||
|
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="sidebar-user-profile">
|
<div class="sidebar-user-profile">
|
||||||
@if(Auth::check())
|
@if(Auth::check())
|
||||||
@php
|
@php
|
||||||
|
|
@ -342,5 +344,39 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function submitLogout() {
|
||||||
|
const tokenEl = document.querySelector('meta[name="csrf-token"]');
|
||||||
|
|
||||||
|
fetch('/studentlogout', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'X-CSRF-TOKEN': tokenEl ? tokenEl.getAttribute('content') : ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (!res.ok) {
|
||||||
|
return res.text().then(text => { throw new Error(text) });
|
||||||
|
}
|
||||||
|
return res.json();
|
||||||
|
})
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
alert('Logged out successfully!');
|
||||||
|
window.location.href = '/students';
|
||||||
|
} else {
|
||||||
|
alert('Logout failed. Please try again.');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error('Error:', err);
|
||||||
|
alert('Server side error occurred during logout.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ use App\Http\Controllers\AuthController;
|
||||||
use App\Http\Controllers\StudentPortalController;
|
use App\Http\Controllers\StudentPortalController;
|
||||||
use App\Http\Controllers\ContactMsgController;
|
use App\Http\Controllers\ContactMsgController;
|
||||||
use App\Http\Controllers\FeedbackController;
|
use App\Http\Controllers\FeedbackController;
|
||||||
|
use App\Http\Controllers\studentportalnavController;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
@ -17,6 +18,8 @@ Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::post('/studentlogout', [studentportalnavController::class, 'logout']);
|
||||||
|
|
||||||
Route::post('/feedback/store', [FeedbackController::class, 'feedback']) ->middleware('auth') ->name('feedback.store');
|
Route::post('/feedback/store', [FeedbackController::class, 'feedback']) ->middleware('auth') ->name('feedback.store');
|
||||||
|
|
||||||
Route::post('/contact-submit', [ContactMsgController::class, 'store'])->name('contact.store');
|
Route::post('/contact-submit', [ContactMsgController::class, 'store'])->name('contact.store');
|
||||||
|
|
@ -72,4 +75,4 @@ Route::view('/Assignments','Assignments')->name('Assignments');
|
||||||
Route::view('/Studentguidelines','Studentguidelines')->name('Studentguidelines');
|
Route::view('/Studentguidelines','Studentguidelines')->name('Studentguidelines');
|
||||||
Route::view('/results','results')->name('results');
|
Route::view('/results','results')->name('results');
|
||||||
Route::view('/Feedback&Complain','Feedback&Complain')->name('Feedback&Complain');
|
Route::view('/Feedback&Complain','Feedback&Complain')->name('Feedback&Complain');
|
||||||
Route::view('/StudentProfile','StudentProfile')->name('StudentProfile');
|
Route::view('/StudentProfile','StudentProfile')->name('StudentProfile');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue