Project Introduction

The Virtual Classroom Platform is an innovative online solution designed to facilitate remote learning and enhance the educational experience for students and educators. This system aims to provide a comprehensive environment for conducting live classes, sharing resources, and engaging in interactive discussions, regardless of geographical barriers. With the growing demand for flexible learning options and the need for effective online education tools, the Virtual Classroom Platform addresses these challenges by offering a user-friendly interface and robust functionalities tailored for both teachers and students.

The platform features tools for video conferencing, screen sharing, real-time chat, and resource sharing, allowing educators to deliver engaging lessons and students to participate actively. Users can access recorded sessions, submit assignments, and collaborate on projects through integrated tools. Additionally, the system includes assessment features to evaluate student performance and track progress. By automating these processes, the Virtual Classroom Platform aims to create an inclusive and effective learning environment that fosters collaboration and knowledge sharing.

Project Objectives

  • To develop an intuitive interface for users to access virtual classrooms and learning materials easily.
  • To implement video conferencing tools for live lectures and interactive sessions.
  • To provide features for screen sharing and resource sharing to enhance teaching effectiveness.
  • To enable real-time chat and discussion forums for student engagement and collaboration.
  • To facilitate assignment submission and feedback mechanisms for students and educators.
  • To generate reports on student attendance, participation, and performance for assessment purposes.
  • To ensure data security and privacy for all user information and educational content.
  • To enhance user engagement through features like notifications for upcoming classes and access to additional learning resources.

User Management Module

  • User Registration/Login: Allow users (students, teachers, administrators) to create accounts and log in securely, often with options for social media or email authentication.
  • Role Management: Differentiate between user roles (e.g., admin, teacher, student) with varying permissions and access levels.
  • Profile Management: Enable users to manage their profiles, including personal information, contact details, and preferences.

Course Management Module

  • Course Creation: Allow teachers to create and manage courses, including course descriptions, objectives, and prerequisites.
  • Syllabus Management: Upload and organize course materials, including lesson plans, assignments, and resources.
  • Course Enrollment: Enable students to enroll in courses and manage their course registrations.

Live Class Module

  • Video Conferencing: Integrate video conferencing tools to facilitate live classes, including features like screen sharing, breakout rooms, and virtual whiteboards.
  • Class Scheduling: Allow teachers to schedule live classes and notify students of upcoming sessions.
  • Attendance Tracking: Monitor student attendance during live classes and generate attendance reports.

Content Delivery Module

  • Resource Upload: Allow teachers to upload and share various types of content, including videos, documents, and presentations.
  • Interactive Learning Materials: Provide tools for creating interactive quizzes, polls, and assignments to engage students.
  • Discussion Forums: Enable students and teachers to participate in discussions related to course content.

Assessment and Evaluation Module

  • Quiz and Test Creation: Allow teachers to create quizzes and assessments to evaluate student knowledge and skills.
  • Grading and Feedback: Automatically grade assessments and provide feedback to students.
  • Progress Tracking: Monitor student progress throughout the course, including completion of modules and assessments.

Communication Module

  • Internal Messaging: Facilitate communication between teachers and students through a secure messaging system.
  • Announcements: Allow teachers to post announcements and important updates for students.
  • Notifications: Send notifications for new assignments, upcoming classes, and important deadlines.

Reporting and Analytics Module

  • Performance Reports: Generate reports on student performance, including grades, attendance, and participation.
  • Engagement Analytics: Analyze student engagement metrics, such as time spent on course materials and participation in discussions.
  • Course Feedback: Collect feedback from students on course content, teaching effectiveness, and overall experience.

Payment Management Module (Optional)

  • Fee Structure Management: Define and manage course fees, discounts, and payment plans.
  • Payment Processing: Integrate with payment gateways for secure online transactions.
  • Invoice Generation: Automatically generate invoices for course fees and payments.

Security and Privacy Module

  • Data Security: Ensure that sensitive user data and course materials are stored securely.
  • Access Control: Manage access to different modules and features based on user roles.

Feedback and Support Module

  • User Feedback Collection: Allow users to provide feedback on the platform and suggest improvements.
  • Help Center: Provide FAQs, tutorials, and support documentation to assist users with common issues.

Project Tables Queries


-- Create Users Table
CREATE TABLE Users (
UserId INT PRIMARY KEY IDENTITY(1,1),
Username NVARCHAR(50) NOT NULL UNIQUE,
PasswordHash NVARCHAR(256) NOT NULL,
Email NVARCHAR(100) NOT NULL UNIQUE,
FirstName NVARCHAR(50) NOT NULL,
LastName NVARCHAR(50) NOT NULL,
RoleId INT NOT NULL,
CreatedAt DATETIME DEFAULT GETDATE(),
UpdatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (RoleId) REFERENCES Roles(RoleId)
);
-- Create Roles Table
CREATE TABLE Roles (
RoleId INT PRIMARY KEY IDENTITY(1,1),
RoleName NVARCHAR(50) NOT NULL UNIQUE,
CreatedAt DATETIME DEFAULT GETDATE(),
UpdatedAt DATETIME DEFAULT GETDATE()
);
-- Create Courses Table
CREATE TABLE Courses (
CourseId INT PRIMARY KEY IDENTITY(1,1),
CourseName NVARCHAR(100) NOT NULL,
Description NVARCHAR(MAX),
CreatedBy INT NOT NULL,
CreatedAt DATETIME DEFAULT GETDATE(),
UpdatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (CreatedBy) REFERENCES Users(UserId)
);
-- Create Syllabus Table
CREATE TABLE Syllabus (
SyllabusId INT PRIMARY KEY IDENTITY(1,1),
CourseId INT NOT NULL,
Topic NVARCHAR(100) NOT NULL,
Description NVARCHAR(MAX),
CreatedAt DATETIME DEFAULT GETDATE(),
UpdatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
);
-- Create LiveClasses Table
CREATE TABLE LiveClasses (
LiveClassId INT PRIMARY KEY IDENTITY(1,1),
CourseId INT NOT NULL,
ClassDate DATETIME NOT NULL,
Duration INT NOT NULL, -- Duration in minutes
Link NVARCHAR(255) NOT NULL, -- Link to the live class
CreatedAt DATETIME DEFAULT GETDATE(),
UpdatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
);
-- Create Resources Table
CREATE TABLE Resources (
ResourceId INT PRIMARY KEY IDENTITY(1,1),
CourseId INT NOT NULL,
ResourceName NVARCHAR(100) NOT NULL,
ResourceType NVARCHAR(50) NOT NULL, -- e.g., Video, Document, Link
ResourceLink NVARCHAR(255),
CreatedAt DATETIME DEFAULT GETDATE(),
UpdatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
);
-- Create Quizzes Table
CREATE TABLE Quizzes (
QuizId INT PRIMARY KEY IDENTITY(1,1),
CourseId INT NOT NULL,
QuizName NVARCHAR(100) NOT NULL,
TotalMarks INT NOT NULL,
CreatedAt DATETIME DEFAULT GETDATE(),
UpdatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
);
-- Create Grades Table
CREATE TABLE Grades (
GradeId INT PRIMARY KEY IDENTITY(1,1),
UserId INT NOT NULL,
QuizId INT NOT NULL,
MarksObtained INT NOT NULL,
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (User Id) REFERENCES Users(UserId),
FOREIGN KEY (QuizId) REFERENCES Quizzes(QuizId)
);
-- Create Notifications Table
CREATE TABLE Notifications (
NotificationId INT PRIMARY KEY IDENTITY(1,1),
UserId INT NOT NULL,
Message NVARCHAR(255) NOT NULL,
IsRead BIT NOT NULL DEFAULT 0,
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (User Id) REFERENCES Users(UserId)
);
-- Create Payments Table
CREATE TABLE Payments (
PaymentId INT PRIMARY KEY IDENTITY(1,1),
UserId INT NOT NULL,
CourseId INT NOT NULL,
Amount DECIMAL(18, 2) NOT NULL,
PaymentDate DATETIME DEFAULT GETDATE(),
PaymentStatus NVARCHAR(50) NOT NULL, -- e.g., Completed, Pending
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (User Id) REFERENCES Users(UserId),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
);
-- Create Feedback Table
CREATE TABLE Feedback (
FeedbackId INT PRIMARY KEY IDENTITY(1,1),
UserId INT NOT NULL,
CourseId INT NOT NULL,
FeedbackContent NVARCHAR(MAX) NOT NULL,
CreatedAt DATETIME DEFAULT GETDATE(),
FOREIGN KEY (User Id) REFERENCES Users(UserId),
FOREIGN KEY (CourseId) REFERENCES Courses(CourseId)
);

Explanation of Tables

Users: Stores user information, including their role in the platform.

Roles: Defines different roles (e.g., Student, Instructor, Admin) in the system.

Courses: Manages course details, including descriptions and the creator of the course.

Syllabus: Contains topics and descriptions for each course, outlining the curriculum.

LiveClasses: Tracks live class sessions, including dates, durations, and access links.

Resources: Stores educational resources associated with courses, such as videos and documents.

Quizzes: Manages quizzes for courses, including total marks and associated course.

Grades: Records grades for users based on their performance in quizzes.

Notifications: Stores notifications for users regarding course updates and other relevant information.

Payments: Manages payment transactions for course enrollments, including amounts and statuses.

Feedback: Collects user feedback on courses, allowing for improvements and adjustments.

To create a Laravel application based on the provided MySQL schema, we will follow these steps:

Create Models and Migrations for each table.

Create Controllers for CRUD operations.

Define Routes for the controllers.

Create Views using Bootstrap 5.

Create a Dashboard to display consolidated data.

Step 1: Create Models and Migrations

You can create models and migrations using the Artisan command line tool. Here are the commands for each model:


php artisan make:model User -m
php artisan make:model Role -m
php artisan make:model Course -m
php artisan make:model Syllabus -m
php artisan make:model LiveClass -m
php artisan make:model Resource -m
php artisan make:model Quiz -m
php artisan make:model Grade -m
php artisan make:model Notification -m
php artisan make:model Payment -m
php artisan make:model Feedback -m

Next, you will need to define the schema in the migration files located in the database/migrations directory. Here's an example for each migration:

Migration for Users Table


// database/migrations/2025_02_01_000001_create_users_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id('User Id');
$table->string('Username')->unique();
$table->string('PasswordHash');
$table->string('Email')->unique();
$table->string('FirstName');
$table->string('LastName');
$table->foreignId('RoleId')->constrained('roles');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('users');
}
}

Migration for Roles Table


// database/migrations/2025_02_01_000002_create_roles_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateRolesTable extends Migration
{
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->id('RoleId');
$table->string('RoleName')->unique();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('roles');
}
}

Repeat for Other Tables

You will need to create similar migration files for the other tables (Courses, Syllabus, LiveClasses, Resources, Quizzes, Grades, Notifications, Payments, Feedback). Make sure to adjust the fields and foreign key constraints accordingly.

Step 2: Create Controllers

You can create controllers for each model using the following commands:


php artisan make:controller UserController --resource
php artisan make:controller RoleController --resource
php artisan make:controller CourseController --resource
php artisan make:controller SyllabusController --resource
php artisan make:controller LiveClassController --resource
php artisan make:controller ResourceController --resource
php artisan make:controller QuizController --resource
php artisan make:controller GradeController --resource
php artisan make:controller NotificationController --resource
php artisan make:controller PaymentController --resource
php artisan make:controller FeedbackController --resource

Each controller will have methods for the CRUD operations (index, create, store, show, edit, update, destroy).

Step 3: Define Routes

In the routes/web.php file, you can define the routes for the controllers:


use App\Http\Controllers\UserController;
use App\Http\Controllers\RoleController;
use App\Http\Controllers\CourseController;
use App\Http\Controllers\SyllabusController;
use App\Http\Controllers\LiveClassController;
use App\Http\Controllers\ResourceController;
use App\Http\Controllers\QuizController;
use App\Http\Controllers\GradeController;
use App\Http\Controllers\NotificationController;
use App\Http\Controllers\PaymentController;
use App\Http\Controllers\FeedbackController;
Route::resource('users', UserController::class);
Route::resource('roles', RoleController::class);
Route::resource('courses', CourseController::class);
Route::resource('syllabus', SyllabusController::class);
Route::resource('live-classes', LiveClassController::class);
Route::resource('resources', ResourceController::class);
Route::resource('quizzes', QuizController::class);
Route::resource('grades', GradeController::class);
Route::resource('notifications', NotificationController::class);
Route::resource('payments', PaymentController::class);
Route::resource('feedback', FeedbackController::class);

// Dashboard Route


Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');

Step 4: Create Views

You can create views for each resource in the resources/views directory. Here's an example of a view for the User model using Bootstrap 5:


<!-- resources/views/users/index.blade.php -->
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Users</h1>
<a href="{{ route('users.create') }}" class="btn btn-primary">Add User</a>
<table class="table">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>First Name</th>
<th>Last Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($users as $user)
<tr>
<td>{{ $user->Username }}</td>
<td>{{ $user->Email }}</td>
<td>{{ $user->FirstName }}</td>
<td>{{ $user->LastName }}</td>
<td>
<a href="{{ route('users.edit', $user->User Id) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('users.destroy', $user->User Id) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

Step 5: Create a Dashboard

You can create a dashboard controller and view to display consolidated data:


php artisan make:controller DashboardController

Dashboard Controller


// app/Http/Controllers/DashboardController.php
namespace App\Http\Controllers;
use App\Models\User;
use App\Models\Course;
use App\Models\Payment;
use Illuminate\Http\Request;
class DashboardController extends Controller
{
public function index()
{
$totalUsers = User::count();
$totalCourses = Course::count();
$totalPayments = Payment::sum('Amount');
return view('dashboard.index', compact('totalUsers', 'totalCourses', 'totalPayments'));
}
}

Dashboard View


<!-- resources/views/dashboard/index.blade.php -->
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Dashboard</h1>
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Total Users</h5>
<p class="card-text">{{ $totalUsers }}</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Total Courses</h5>
<p class="card-text">{{ $totalCourses }}</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-body">
<h5 class="card-title">Total Payments</h5>
<p class="card-text">${{ number_format($totalPayments, 2) }}</p>
</div>
</div>
</div>
</div>
</div>
@endsection

This setup will provide a basic structure for your Laravel application, allowing you to manage users, roles, courses, and other related entities while displaying consolidated data on the dashboard.

Step 6: Set Up Authentication

To manage user authentication, you can use Laravel Breeze or Laravel Jetstream. Here's how to set up Laravel Breeze:


composer require laravel/breeze --dev
php artisan breeze:install
npm install && npm run dev
php artisan migrate

This will set up the authentication scaffolding, including login, registration, and password reset functionalities.

Step 7: Middleware for Role Management

To restrict access based on user roles, you can create middleware:


php artisan make:middleware RoleMiddleware

Role Middleware Implementation


namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RoleMiddleware
{
public function handle(Request $request, Closure $next, ...$roles)
{
if (!Auth::check() || !in_array(Auth::user()->RoleId, $roles)) {
return redirect('/')->with('error', 'You do not have access to this resource.');
}
return $next($request);
}
}

Register Middleware

Register the middleware in app/Http/Kernel.php:


protected $routeMiddleware = [
// ...
'role' => \App\Http\Middleware\RoleMiddleware::class,
];

Step 8: Protect Routes with Middleware

You can protect your routes by applying the middleware:


Route::group(['middleware' => ['auth', 'role:1']], function () {
Route::resource('users', UserController::class);
Route::resource('roles', RoleController::class);
// Other admin routes
});

Step 9: Seed Database with Sample Data

To populate your database with sample data, you can create seeders:


php artisan make:seeder UserSeeder
php artisan make:seeder RoleSeeder
php artisan make:seeder CourseSeeder

Example Seeder for Users


namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\User;
class UserSeeder extends Seeder
{
public function run()
{
User::create([
'Username' => 'admin',
'PasswordHash' => bcrypt('password'),
'Email' => 'admin@example.com',
'FirstName' => 'Admin',
'LastName' => 'User ',
'RoleId' => 1,
]);
}
}

Run Seeders

You can run the seeders using:


php artisan db:seed --class=User Seeder
php artisan db:seed --class=RoleSeeder
php artisan db:seed --class=CourseSeeder

Step 10: Testing the Application

After setting everything up, you can test your application by running the built-in server:


php artisan serve

Visit http://localhost:8000 in your browser to access the application. You can log in with the credentials you set in the seeder and navigate through the various functionalities.

Step 11: Deployment

When you're ready to deploy your application, ensure you set up your environment variables in the .env file, configure your database connection, and run migrations and seeders on the production server.

This completes the setup for your Laravel application based on the provided MySQL schema, including user authentication, role management, and a dashboard for consolidated data.

Below are the complete model and migration files for each of the tables defined in your MySQL schema.

1. User Model and Migration

Model: User.php


// app/Models/User.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use HasFactory;
protected $table = 'users';
protected $fillable = [
'Username',
'PasswordHash',
'Email',
'FirstName',
'LastName',
'RoleId',
];
public function role()
{
return $this->belongsTo(Role::class, 'RoleId');
}
public function courses()
{
return $this->hasMany(Course::class, 'CreatedBy');
}
public function grades()
{
return $this->hasMany(Grade::class);
}
public function notifications()
{
return $this->hasMany(Notification::class);
}
public function payments()
{
return $this->hasMany(Payment::class);
}
public function feedbacks()
{
return $this->hasMany(Feedback::class);
}
}

Migration: create_users_table.php

// database/migrations/2025_02_01_000001_create_users_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id('User Id');
$table->string('Username')->unique();
$table->string('PasswordHash');
$table->string('Email')->unique();
$table->string('FirstName');
$table->string('LastName');
$table->foreignId('RoleId')->constrained('roles');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('users');
}
}

2. Role Model and Migration

Model: Role.php


// app/Models/Role.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Role extends Model
{
use HasFactory;
protected $table = 'roles';
protected $fillable = [
'RoleName',
];
public function users()
{
return $this->hasMany(User::class, 'RoleId');
}
}

Migration: create_roles_table.php
// database/migrations/2025_02_01_000002_create_roles_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateRolesTable extends Migration
{
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->id('RoleId');
$table->string('RoleName')->unique();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('roles');
}
}

3. Course Model and Migration

Model: Course.php


// app/Models/Course.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Course extends Model
{
use HasFactory;
protected $table = 'courses';
protected $fillable = [
'CourseName',
'Description',
'CreatedBy',
];
public function user()
{
return $this->belongsTo(User::class, 'CreatedBy');
}
public function syllabus()
{
return $this->hasMany(Syllabus::class);
}
public function liveClasses()
{
return $this->hasMany(LiveClass::class);
}
public function resources()
{
return $this->hasMany(Resource::class);
}
public function quizzes()
{
return $this->hasMany(Quiz::class);
}
public function payments()
{
return $this->hasMany(Payment::class);
}
public function feedbacks()
{
return $this->hasMany(Feedback::class);
}
}

Migration: create_courses_table.php


// database/migrations/2025_02_01_000003_create_courses_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCoursesTable extends Migration
{
public function up()
{
Schema::create('courses', function (Blueprint $table) {
$table->id('CourseId');
$table->string('CourseName');
$table->text('Description')->nullable();
$table->foreignId('CreatedBy')->constrained('users');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('courses');
}
}

4. Syllabus Model and Migration

Model: Syllabus.php


// app/Models/Syllabus.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Syllabus extends Model
{
use HasFactory;
protected $table = 'syllabus';
protected $fillable = [
'CourseId',
'Topic',
'Description',
];
public function course()
{
return $this->belongsTo(Course::class, 'CourseId');
}
}

Migration: create_syllabus_table.php


// database/migrations/2025_02_01_000004_create_syllabus_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSyllabusTable extends Migration
{
public function up()
{
Schema::create('syllabus', function (Blueprint $table) {
$table->id('SyllabusId');
$table->foreignId('CourseId')->constrained('courses');
$table->string('Topic');
$table->text('Description')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('syllabus');
}
}

5. LiveClass Model and Migration

Model: LiveClass.php


// app/Models/LiveClass.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class LiveClass extends Model
{
use HasFactory;
protected $table = 'live_classes';
protected $fillable = [
'CourseId',
'ClassDate',
'Duration',
'Link',
];
public function course()
{
return $this->belongsTo(Course::class, 'CourseId');
}
}

Migration: create_live_classes_table.php


// database/migrations/2025_02_01_000005_create_live_classes_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLiveClassesTable extends Migration
{
public function up()
{
Schema::create('live_classes', function (Blueprint $table) {
$table->id('LiveClassId');
$table->foreignId('CourseId')->constrained('courses');
$table->dateTime('ClassDate');
$table->integer('Duration'); // Duration in minutes
$table->string('Link');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('live_classes');
}
}

6. Resource Model and Migration

Model: Resource.php


// app/Models/Resource.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Resource extends Model
{
use HasFactory;
protected $table = 'resources';
protected $fillable = [
'CourseId',
'ResourceName',
'ResourceType',
'ResourceLink',
];
public function course()
{
return $this->belongsTo(Course::class, 'CourseId');
}
}

Migration: create_resources_table.php


// database/migrations/2025_02_01_000006_create_resources_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateResourcesTable extends Migration
{
public function up()
{
Schema::create('resources', function (Blueprint $table) {
$table->id('ResourceId');
$table->foreignId('CourseId')->constrained('courses');
$table->string('ResourceName');
$table->string('ResourceType'); // e.g., Video, Document, Link
$table->string('ResourceLink')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('resources');
}
}

7. Quiz Model and Migration

Model: Quiz.php


// app/Models/Quiz.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Quiz extends Model
{
use HasFactory;
protected $table = 'quizzes';
protected $fillable = [
'CourseId',
'QuizName',
'TotalMarks',
];
public function course()
{
return $this->belongsTo(Course::class, 'CourseId');
}
public function grades()
{
return $this->hasMany(Grade::class);
}
}

Migration: create_quizzes_table.php


// database/migrations/2025_02_01_000007_create_quizzes_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateQuizzesTable extends Migration
{
public function up()
{
Schema::create('quizzes', function (Blueprint $table) {
$table->id('QuizId');
$table->foreignId('CourseId')->constrained('courses');
$table->string('QuizName');
$table->integer('TotalMarks');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('quizzes');
}
}

8. Grade Model and Migration

Model: Grade.php


// app/Models/Grade.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Grade extends Model
{
use HasFactory;
protected $table = 'grades';
protected $fillable = [
'User Id',
'QuizId',
'MarksObtained',
];
public function user()
{
return $this->belongsTo(User::class, 'User Id');
}
public function quiz()
{
return $this->belongsTo(Quiz::class, 'QuizId');
}
}

Migration: create_grades_table.php


// database/migrations/2025_02_01_000008_create_grades_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateGradesTable extends Migration
{
public function up()
{
Schema::create('grades', function (Blueprint $table) {
$ table->id('GradeId');
$table->foreignId('User Id')->constrained('users');
$table->foreignId('QuizId')->constrained('quizzes');
$table->integer('MarksObtained');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('grades');
}
}

9. Notification Model and Migration

Model: Notification.php


// app/Models/Notification.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Notification extends Model
{
use HasFactory;
protected $table = 'notifications';
protected $fillable = [
'User Id',
'Message',
'IsRead',
];
public function user()
{
return $this->belongsTo(User::class, 'User Id');
}
}

Migration: create_notifications_table.php


// database/migrations/2025_02_01_000009_create_notifications_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotificationsTable extends Migration
{
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->id('NotificationId');
$table->foreignId('User Id')->constrained('users');
$table->string('Message');
$table->boolean('IsRead')->default(0);
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('notifications');
}
}

10. Payment Model and Migration

Model: Payment.php


// app/Models/Payment.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
use HasFactory;
protected $table = 'payments';
protected $fillable = [
'User Id',
'CourseId',
'Amount',
'PaymentDate',
'PaymentStatus',
];
public function user()
{
return $this->belongsTo(User::class, 'User Id');
}
public function course()
{
return $this->belongsTo(Course::class, 'CourseId');
}
}

Migration: create_payments_table.php


// database/migrations/2025_02_01_000010_create_payments_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentsTable extends Migration
{
public function up()
{
Schema::create('payments', function (Blueprint $table) {
$table->id('PaymentId');
$table->foreignId('User Id')->constrained('users');
$table->foreignId('CourseId')->constrained('courses');
$table->decimal('Amount', 18, 2);
$table->dateTime('PaymentDate')->default(now());
$table->string('PaymentStatus'); // e.g., Completed, Pending
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('payments');
}
}

11. Feedback Model and Migration

Model: Feedback.php


// app/Models/Feedback.php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Feedback extends Model
{
use HasFactory;
protected $table = 'feedback';
protected $fillable = [
'User Id',
'CourseId',
'FeedbackContent',
];
public function user()
{
return $this->belongsTo(User::class, 'User Id');
}
public function course()
{
return $this->belongsTo(Course::class, 'CourseId');
}
}

Migration: create_feedback_table.php


// database/migrations/2025_02_01_000011_create_feedback_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFeedbackTable extends Migration
{
public function up()
{
Schema::create('feedback', function (Blueprint $table) {
$table->id('FeedbackId');
$table->foreignId('User Id')->constrained('users');
$table->foreignId('CourseId')->constrained('courses');
$table->text('FeedbackContent');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('feedback');
}
}

This completes the creation of all models and migrations for your Laravel application based on the provided MySQL schema.

You can now run the migrations using the command:


php artisan migrate

Create controller for each model with complete CRUD operation for view.

Below are the controllers for each model with complete CRUD operations. Each controller will include methods for listing, creating, storing, showing, editing, updating, and deleting records.

1. UserController

Controller: UserController.php


// app/Http/Controllers/UserController.php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function index()
{
$users = User::all();
return view('users.index', compact('users'));
}
public function create()
{
return view('users.create');
}
public function store(Request $request)
{
$request->validate([
'Username' => 'required|unique:users',
'PasswordHash' => 'required',
'Email' => 'required|email|unique:users',
'FirstName' => 'required',
'LastName' => 'required',
'RoleId' => 'required|exists:roles,RoleId',
]);
User::create($request->all());
return redirect()->route('users.index')->with('success', 'User created successfully.');
}
public function show(User $user)
{
return view('users.show', compact('user'));
}
public function edit(User $user)
{
return view('users.edit', compact('user'));
}
public function update(Request $request, User $user)
{
$request->validate([
'Username' => 'required|unique:users,Username,' . $user->User Id,
'PasswordHash' => 'required',
'Email' => 'required|email|unique:users,Email,' . $user->User Id,
'FirstName' => 'required',
'LastName' => 'required',
'RoleId' => 'required|exists:roles,RoleId',
]);
$user->update($request->all());
return redirect()->route('users.index')->with('success', 'User updated successfully.');
}
public function destroy(User $user)
{
$user->delete();
return redirect()->route('users.index')->with('success', 'User deleted successfully.');
}
}

2. RoleController

Controller: RoleController.php


// app/Http/Controllers/RoleController.php
namespace App\Http\Controllers;
use App\Models\Role;
use Illuminate\Http\Request;
class RoleController extends Controller
{
public function index()
{
$roles = Role::all();
return view('roles.index', compact('roles'));
}
public function create()
{
return view('roles.create');
}
public function store(Request $request)
{
$request->validate([
'RoleName' => 'required|unique:roles',
]);
Role::create($request->all());
return redirect()->route('roles.index')->with('success', 'Role created successfully.');
}
public function show(Role $role)
{
return view('roles.show', compact('role'));
}
public function edit(Role $role)
{
return view('roles.edit', compact('role'));
}
public function update(Request $request, Role $role)
{
$request->validate([
'RoleName' => 'required|unique:roles,RoleName,' . $role->RoleId,
]);
$role->update($request->all());
return redirect()->route('roles.index')->with('success', 'Role updated successfully.');
}
public function destroy(Role $role)
{
$role->delete();
return redirect()->route('roles.index')->with('success', 'Role deleted successfully.');
}
}

3. CourseController

Controller: CourseController.php


// app/Http/Controllers/CourseController.php
namespace App\Http\Controllers;
use App\Models\Course;
use App\Models\User;
use Illuminate\Http\Request;
class CourseController extends Controller
{
public function index()
{
$courses = Course::all();
return view('courses.index', compact('courses'));
}
public function create()
{
$users = User::all();
return view('courses.create', compact('users'));
}
public function store(Request $request)
{
$request->validate([
'CourseName' => 'required',
'Description' => 'nullable',
'CreatedBy' => 'required|exists:users,User Id',
]);
Course::create($request->all());
return redirect()->route('courses.index')->with('success', 'Course created successfully.');
}
public function show(Course $course)
{
return view('courses.show', compact('course'));
}
public function edit(Course $course)
{
$users = User::all();
return view('courses.edit', compact('course', 'users'));
}
public function update(Request $request, Course $course)
{
$request->validate([
'CourseName' => 'required',
'Description' => 'nullable',
'CreatedBy' => 'required|exists:users,User Id',
]);
$course->update($request->all());
return redirect()->route('courses.index')->with('success', 'Course updated successfully.');
}
public function destroy(Course $course)
{
$course->delete();
return redirect()->route('courses.index')->with('success', 'Course deleted successfully.');
}
}

4. SyllabusController

Controller: SyllabusController.php


// app/Http/Controllers/SyllabusController.php
namespace App\Http\Controllers;
use App\Models\Syllabus;
use App\Models\Course;
use Illuminate\Http\Request;
class SyllabusController extends Controller
{
public function index()
{
$syllabuses = Syllabus::all();
return view('syllabus.index', compact('syllabuses'));
}
public function create()
{
$courses = Course::all();
return view('syllabus.create', compact('courses'));
}
public function store(Request $request)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'Topic' => 'required',
'Description' => 'nullable',
]);
Syllabus::create($request->all());
return redirect()->route('syllabus.index')->with('success', 'Syllabus created successfully.');
}
public function show(Syllabus $syllabus)
{
return view('syllabus.show', compact('syllabus'));
}
public function edit(Syllabus $syllabus)
{
$courses = Course::all();
return view('syllabus.edit', compact('syllabus', 'courses'));
}
public function update(Request $request, Syllabus $syllabus)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'Topic' => 'required',
'Description' => 'nullable',
]);
$syllabus->update($request->all());
return redirect()->route('syllabus.index')->with('success', 'Syllabus updated successfully.');
}
public function destroy(Syllabus $syllabus)
{
$syllabus->delete();
return redirect()->route('syllabus.index')->with('success', 'Syllabus deleted successfully.');
}
}

5. LiveClassController

Controller: LiveClassController.php


// app/Http/Controllers/LiveClassController.php
namespace App\Http\Controllers;
use App\Models\LiveClass;
use App\Models\Course;
use Illuminate\Http\Request;
class LiveClassController extends Controller
{
public function index()
{
$liveClasses = LiveClass::all();
return view('live_classes.index', compact('liveClasses'));
}
public function create()
{
$courses = Course::all();
return view('live_classes.create', compact('courses'));
}
public function store(Request $request)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'ClassDate' => 'required|date',
'Duration' => 'required|integer',
'Link' => 'required|url',
]);
LiveClass::create($request->all());
return redirect()->route('live_classes.index')->with('success', 'Live class created successfully.');
}
public function show(LiveClass $liveClass)
{
return view('live_classes.show', compact('liveClass'));
}
public function edit(LiveClass $liveClass)
{
$courses = Course::all();
return view('live_classes.edit', compact('liveClass', 'courses'));
}
public function update(Request $request, LiveClass $liveClass)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'ClassDate' => 'required|date',
'Duration' => 'required|integer',
'Link' => 'required|url',
]);
$liveClass->update($request->all());
return redirect()->route('live_classes.index')->with('success', 'Live class updated successfully.');
}
public function destroy(LiveClass $liveClass)
{
$liveClass->delete();
return redirect()->route('live_classes.index')->with('success', 'Live class deleted successfully.');
}
}

6. ResourceController

Controller: ResourceController.php


// app/Http/Controllers/ResourceController.php
namespace App\Http\Controllers;
use App\Models\Resource;
use App\Models\Course;
use Illuminate\Http\Request;
class ResourceController extends Controller
{
public function index()
{
$resources = Resource::all();
return view('resources.index', compact('resources'));
}
public function create()
{
$courses = Course::all();
return view('resources.create', compact('courses'));
}
public function store(Request $request)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'ResourceName' => 'required',
'ResourceType' => 'required',
'ResourceLink' => 'nullable|url',
]);
Resource::create($request->all());
return redirect()->route('resources.index')->with('success', 'Resource created successfully.');
}
public function show(Resource $resource)
{
return view('resources.show', compact('resource'));
}
public function edit(Resource $resource)
{
$courses = Course::all();
return view('resources.edit', compact('resource', 'courses'));
}
public function update(Request $request, Resource $resource)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'ResourceName' => 'required',
'ResourceType' => 'required',
'ResourceLink' => 'nullable|url',
]);
$resource->update($request->all());
return redirect()->route('resources.index')->with('success', 'Resource updated successfully.');
}
public function destroy(Resource $resource)
{
$resource->delete();
return redirect()->route('resources.index')->with('success', 'Resource deleted successfully.');
}
}

7. QuizController

Controller: QuizController.php


// app/Http/Controllers/QuizController.php
namespace App\Http\Controllers;
use App\Models\Quiz;
use App\Models\Course;
use Illuminate\Http\Request;
class QuizController extends Controller
{
public function index()
{
$quizzes = Quiz::all();
return view('quizzes.index', compact('quizzes'));
}
public function create()
{
$courses = Course::all();
return view('quizzes.create', compact('courses'));
}
public function store(Request $request)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'QuizName' => 'required',
'TotalMarks' => 'required|integer',
]);
Quiz::create($request->all());
return redirect()->route('quizzes.index')->with('success', 'Quiz created successfully.');
}
public function show(Quiz $quiz)
{
return view('quizzes.show', compact('quiz'));
}
public function edit(Quiz $quiz)
{
$courses = Course::all();
return view('quizzes.edit', compact('quiz', 'courses'));
}
public function update(Request $request, Quiz $quiz)
{
$request->validate([
'CourseId' => 'required|exists:courses,CourseId',
'QuizName' => 'required',
'TotalMarks' => 'required|integer',
]);
$quiz->update($request->all());
return redirect()->route('quizzes.index')->with('success', 'Quiz updated successfully.');
}
public function destroy(Quiz $quiz)
{
$quiz->delete();
return redirect()->route('quizzes.index')->with('success', 'Quiz deleted successfully.');
}
}

8. GradeController

Controller: GradeController.php


// app/Http/Controllers/GradeController.php
namespace App\Http\Controllers;
use App\Models\Grade;
use App\Models\User;
use App\Models\Quiz;
use Illuminate\Http\Request;
class GradeController extends Controller
{
public function index()
{
$grades = Grade::all();
return view('grades.index', compact('grades'));
}
public function create()
{
$users = User::all();
$quizzes = Quiz::all();
return view('grades.create', compact('users', 'quizzes'));
}
public function store(Request $request)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'QuizId' => 'required|exists:quizzes,QuizId',
'MarksObtained' => 'required|integer',
]);
Grade::create($request->all());
return redirect()->route('grades.index')->with('success', 'Grade created successfully.');
}
public function show(Grade $grade)
{
return view('grades.show', compact('grade'));
}
public function edit(Grade $grade)
{
$users = User::all();
$quizzes = Quiz::all();
return view('grades.edit', compact('grade', 'users', 'quizzes'));
}
public function update(Request $request, Grade $grade)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'QuizId' => 'required|exists:quizzes,QuizId',
'MarksObtained' => 'required|integer',
]);
$grade->update($request->all());
return redirect()->route('grades.index')->with('success', 'Grade updated successfully.');
}
public function destroy(Grade $grade)
{
$grade->delete();
return redirect()->route('grades.index')->with('success', 'Grade deleted successfully.');
}
}

9. NotificationController

Controller: NotificationController.php


// app/Http/Controllers/NotificationController.php
namespace App\Http\Controllers;
use App\Models\Notification;
use App\Models\User;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
public function index()
{
$notifications = Notification::all();
return view('notifications.index', compact('notifications'));
}
public function create()
{
$users = User::all();
return view('notifications.create', compact('users'));
}
public function store(Request $request)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'Message' => 'required',
'IsRead' => 'boolean',
]);
Notification::create($request->all());
return redirect()->route('notifications.index')->with('success', 'Notification created successfully.');
}
public function show(Notification $notification)
{
return view('notifications.show ', compact('notification'));
}
public function edit(Notification $notification)
{
$users = User::all();
return view('notifications.edit', compact('notification', 'users'));
}
public function update(Request $request, Notification $notification)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'Message' => 'required',
'IsRead' => 'boolean',
]);
$notification->update($request->all());
return redirect()->route('notifications.index')->with('success', 'Notification updated successfully.');
}
public function destroy(Notification $notification)
{
$notification->delete();
return redirect()->route('notifications.index')->with('success', 'Notification deleted successfully.');
}
}

10. PaymentController

Controller: PaymentController.php


// app/Http/Controllers/PaymentController.php
namespace App\Http\Controllers;
use App\Models\Payment;
use App\Models\User;
use App\Models\Course;
use Illuminate\Http\Request;
class PaymentController extends Controller
{
public function index()
{
$payments = Payment::all();
return view('payments.index', compact('payments'));
}
public function create()
{
$users = User::all();
$courses = Course::all();
return view('payments.create', compact('users', 'courses'));
}
public function store(Request $request)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'CourseId' => 'required|exists:courses,CourseId',
'Amount' => 'required|numeric',
'PaymentDate' => 'required|date',
'PaymentStatus' => 'required|string',
]);
Payment::create($request->all());
return redirect()->route('payments.index')->with('success', 'Payment created successfully.');
}
public function show(Payment $payment)
{
return view('payments.show', compact('payment'));
}
public function edit(Payment $payment)
{
$users = User::all();
$courses = Course::all();
return view('payments.edit', compact('payment', 'users', 'courses'));
}
public function update(Request $request, Payment $payment)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'CourseId' => 'required|exists:courses,CourseId',
'Amount' => 'required|numeric',
'PaymentDate' => 'required|date',
'PaymentStatus' => 'required|string',
]);
$payment->update($request->all());
return redirect()->route('payments.index')->with('success', 'Payment updated successfully.');
}
public function destroy(Payment $payment)
{
$payment->delete();
return redirect()->route('payments.index')->with('success', 'Payment deleted successfully.');
}
}

11. FeedbackController

Controller: FeedbackController.php


// app/Http/Controllers/FeedbackController.php
namespace App\Http\Controllers;
use App\Models\Feedback;
use App\Models\User;
use App\Models\Course;
use Illuminate\Http\Request;
class FeedbackController extends Controller
{
public function index()
{
$feedbacks = Feedback::all();
return view('feedback.index', compact('feedbacks'));
}
public function create()
{
$users = User::all();
$courses = Course::all();
return view('feedback.create', compact('users', 'courses'));
}
public function store(Request $request)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'CourseId' => 'required|exists:courses,CourseId',
'FeedbackContent' => 'required',
]);
Feedback::create($request->all());
return redirect()->route('feedback.index')->with('success', 'Feedback created successfully.');
}
public function show(Feedback $feedback)
{
return view('feedback.show', compact('feedback'));
}
public function edit(Feedback $feedback)
{
$users = User::all();
$courses = Course::all();
return view('feedback.edit', compact('feedback', 'users', 'courses'));
}
public function update(Request $request, Feedback $feedback)
{
$request->validate([
'User Id' => 'required|exists:users,User Id',
'CourseId' => 'required|exists:courses,CourseId',
'FeedbackContent' => 'required',
]);
$feedback->update($request->all());
return redirect()->route('feedback.index')->with('success', 'Feedback updated successfully.');

public function destroy(Feedback $feedback)
{
$feedback->delete();
return redirect()->route('feedback.index')->with('success', 'Feedback deleted successfully.');
}
}

This completes the creation of controllers for each model with complete CRUD operations.

You can now create the corresponding views for each controller to handle the user interface for managing the data.

Below are example view files for each controller, designed using Bootstrap 5.

1. User Views

resources/views/users/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Users</h1>
<a href="{{ route('users.create') }}" class="btn btn-primary mb-3">Add User</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>First Name</th>
<th>Last Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($users as $user)
<tr>
<td>{{ $user->Username }}</td>
<td>{{ $user->Email }}</td>
<td>{{ $user->FirstName }}</td>
<td>{{ $user->LastName }}</td>
<td>
<a href="{{ route('users.edit', $user->User Id) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('users.destroy', $user->User Id) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/users/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add User</h1>
<form action="{{ route('users.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="Username" class="form-label">Username</label>
<input type="text" class="form-control" id="Username" name="Username" required>
</div>
<div class="mb-3">
<label for="PasswordHash" class="form-label">Password</label>
<input type="password" class="form-control" id="PasswordHash" name="PasswordHash" required>
</div>
<div class="mb-3">
<label for="Email" class="form-label">Email</label>
<input type="email" class="form-control" id="Email" name="Email" required>
</div>
<div class="mb-3">
<label for="FirstName" class="form-label">First Name</label>
<input type="text" class="form-control" id="FirstName" name="FirstName" required>
</div>
<div class="mb-3">
<label for="LastName" class="form-label">Last Name</label>
<input type="text" class="form-control" id="LastName" name="LastName" required>
</div>
<div class="mb-3">
<label for="RoleId" class="form-label">Role</label>
<select class="form-select" id="RoleId" name="RoleId" required>
@foreach ($roles as $role)
<option value="{{ $role->RoleId }}">{{ $role->RoleName }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Create User</button>
</form>
</div>
@endsection

resources/views/users/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit User</h1>
<form action="{{ route('users.update', $user->User Id) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="Username" class="form-label">Username</label>
<input type="text" class="form-control" id="Username" name="Username" value="{{ $user->Username }}" required>
</div>
<div class="mb-3">
<label for="PasswordHash" class="form-label">Password</label>
<input type="password" class="form-control" id="PasswordHash" name="PasswordHash" required>
</div>
<div class="mb-3">
<label for="Email" class="form-label">Email</label>
<input type="email" class="form-control" id="Email" name="Email" value="{{ $user->Email }}" required>
</div>
<div class="mb-3">
<label for="FirstName" class="form-label">First Name</label>
<input type="text" class="form-control" id="FirstName" name="FirstName" value="{{ $user->FirstName }}" required>
</div>
<div class="mb-3">
<label for="LastName" class="form-label">Last Name</label>
<input type="text" class="form-control" id="LastName" name="LastName" value="{{ $user->LastName }}" required>
</div>
<div class="mb-3">
<label for="RoleId" class="form-label">Role</label>
<select class="form-select" id="RoleId" name="RoleId" required>
@foreach ($roles as $role)
<option value="{{ $role->RoleId }}" {{ $role->RoleId == $user->RoleId ? 'selected' : '' }}>{{ $role->RoleName }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Update User</button>
</form>
</div>
@endsection

2. Role Views

resources/views/roles/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Roles</h1>
<a href="{{ route('roles.create') }}" class="btn btn-primary mb-3">Add Role</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Role Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($roles as $role)
<tr>
<td>{{ $role->RoleName }}</td>
<td>
<a href="{{ route('roles.edit', $role->RoleId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('roles.destroy', $role->RoleId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/roles/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Role</h1>
<form action="{{ route('roles.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="RoleName" class="form-label">Role Name</label>
<input type="text" class="form-control" id="RoleName" name="RoleName" required>
</div>
<button type="submit" class="btn btn-primary">Create Role</button>
</form>
</div>
@endsection

resources/views/roles/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Role</h1>
<form action="{{ route('roles.update', $role->RoleId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="RoleName" class="form-label">Role Name</label>
<input type="text" class="form-control" id="RoleName" name="RoleName" value="{{ $role->RoleName }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Role</button>
</form>
</div>
@endsection

3. Course Views

resources/views/courses/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Courses</h1>
<a href="{{ route('courses.create') }}" class="btn btn-primary mb-3">Add Course</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Course Name</th>
<th>Description</th>
<th>Created By</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($courses as $course)
<tr>
<td>{{ $course->CourseName }}</td>
<td>{{ $course->Description }}</td>
<td>{{ $course->CreatedBy }}</td>
<td>
<a href="{{ route('courses.edit', $course->CourseId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('courses.destroy', $course->CourseId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/courses/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Course</h1>
<form action="{{ route('courses.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="CourseName" class="form-label">Course Name</label>
<input type="text" class="form-control" id="CourseName" name="CourseName" required>
</div>
<div class="mb-3">
<label for="Description" class="form-label">Description</label>
<textarea class="form-control" id="Description" name="Description"></textarea>
</div>
<div class="mb-3">
<label for="CreatedBy" class="form-label">Created By</label>
<select class="form-select" id="CreatedBy" name="CreatedBy" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}">{{ $user->Username }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Create Course</button>
</form>
</div>
@endsection

resources/views/courses/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Course</h1>
<form action="{{ route('courses.update', $course->CourseId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="CourseName" class="form-label">Course Name</label>
<input type="text" class="form-control" id="CourseName" name="CourseName" value="{{ $course->CourseName }}" required>
</div>
<div class="mb-3">
<label for="Description" class="form-label">Description</label>
<textarea class="form-control" id="Description" name="Description">{{ $course->Description }}</textarea>
</div>
<div class="mb-3">
<label for="CreatedBy" class="form-label">Created By</label>
<select class="form-select" id="CreatedBy" name="CreatedBy" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}" {{ $user->User Id == $course->CreatedBy ? 'selected' : '' }}>{{ $user->Username }}</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Update Course</button>
</form>
</div>
@endsection

4. Syllabus Views

resources/views/syllabus/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Syllabus</h1>
<a href="{{ route('syllabus.create') }}" class="btn btn-primary mb-3">Add Syllabus</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Course</th>
<th>Topic</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($syllabuses as $syllabus)
<tr>
<td>{{ $syllabus->course->CourseName }}</td>
<td>{{ $syllabus->Topic }}</td>
<td>{{ $syllabus->Description }}</td>
<td>
<a href="{{ route('syllabus.edit', $syllabus->SyllabusId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('syllabus.destroy', $syllabus->SyllabusId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/syllabus/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Syllabus</h1>
<form action="{{ route('syllabus.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}">{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="Topic" class="form-label">Topic</label>
<input type="text" class="form-control" id="Topic" name="Topic" required>
</div>
<div class="mb-3">
<label for="Description" class="form-label">Description</label>
<textarea class="form-control" id="Description" name="Description"></textarea>
</div>
<button type="submit" class="btn btn-primary">Create Syllabus</button>
</form>
</div>
@endsection

resources/views/syllabus/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Syllabus</h1>
<form action="{{ route('syllabus.update', $syllabus->SyllabusId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}" {{ $course->CourseId == $syllabus->CourseId ? 'selected' : '' }}>{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="Topic" class="form-label">Topic</label>
<input type="text" class="form-control" id="Topic" name="Topic" value="{{ $syllabus->Topic }}" required>
</div>
<div class="mb-3">
<label for="Description" class="form-label">Description</label>
<textarea class="form-control" id="Description" name="Description">{{ $syllabus->Description }}</textarea>
</div>
<button type="submit" class="btn btn-primary">Update Syllabus</button>
</form>
</div>
@endsection

5. Live Class Views

resources/views/live_classes/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Live Classes</h1>
<a href="{{ route('live_classes.create') }}" class="btn btn-primary mb-3">Add Live Class</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Course</th>
<th>Class Date</th>
<th>Duration</th>
<th>Link</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($liveClasses as $liveClass)
<tr>
<td>{{ $liveClass->course->CourseName }}</td>
<td>{{ $liveClass->ClassDate }}</td>
<td>{{ $liveClass->Duration }} minutes</td>
<td><a href="{{ $liveClass->Link }}" target="_blank">Join</a></td>
<td>
<a href="{{ route('live_classes.edit', $liveClass->LiveClassId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('live_classes.destroy', $liveClass->LiveClassId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/live_classes/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Live Class</h1>
<form action="{{ route('live_classes.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}">{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="ClassDate" class="form-label">Class Date</label>
<input type="datetime-local" class="form-control" id="ClassDate" name="ClassDate" required>
</div>
<div class="mb-3">
<label for="Duration" class="form-label">Duration (minutes)</label>
<input type="number" class="form-control" id="Duration" name="Duration" required>
</div>
<div class="mb-3">
<label for="Link" class="form-label">Link</label>
<input type="url" class="form-control" id="Link" name="Link" required>
</div>
<button type="submit" class="btn btn-primary">Create Live Class</button>
</form>
</div>
@endsection

resources/views/live_classes/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Live Class</h1>
<form action="{{ route('live_classes.update', $liveClass->LiveClassId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}" {{ $course->CourseId == $liveClass->CourseId ? 'selected' : '' }}>{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="ClassDate" class="form-label">Class Date</label>
<input type="datetime-local" class="form-control" id="ClassDate" name="ClassDate" value="{{ \Carbon\Carbon::parse($liveClass->ClassDate)->format('Y-m-d\TH:i') }}" required>
</div>
<div class="mb-3">
<label for="Duration" class="form-label">Duration (minutes)</label>
<input type="number" class="form-control" id="Duration" name="Duration" value="{{ $liveClass->Duration }}" required>
</div>
<div class="mb-3">
<label for="Link" class="form-label">Link</label>
<input type="url" class="form-control" id="Link" name="Link" value="{{ $liveClass->Link }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Live Class</button>
</form>
</div>
@endsection

6. Resource Views

resources/views/resources/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Resources</h1>
<a href="{{ route('resources.create') }}" class="btn btn-primary mb-3">Add Resource</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Course</th>
<th>Resource Name</th>
<th>Resource Type</th>
<th>Resource Link</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($resources as $resource)
<tr>
<td>{{ $resource->course->CourseName }}</td>
<td>{{ $resource->ResourceName }}</td>
<td>{{ $resource->ResourceType }}</td>
<td><a href="{{ $resource->ResourceLink }}" target="_blank">View</a></td>
<td>
<a href="{{ route('resources.edit', $resource->ResourceId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('resources.destroy', $resource->ResourceId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/resources/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Resource</h1>
<form action="{{ route('resources.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}">{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="ResourceName" class="form-label">Resource Name</label>
<input type="text" class="form-control" id="ResourceName" name="ResourceName" required>
</div>
<div class="mb-3">
<label for="ResourceType" class="form-label">Resource Type</label>
<input type="text" class="form-control" id="ResourceType" name="ResourceType" required>
</div>
<div class="mb-3">
<label for="ResourceLink" class="form-label">Resource Link</label>
<input type="url" class="form-control" id="ResourceLink" name="ResourceLink " required>
</div>
<button type="submit" class="btn btn-primary">Create Resource</button>
</form>
</div>
@endsection

resources/views/resources/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Resource</h1>
<form action="{{ route('resources.update', $resource->ResourceId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}" {{ $course->CourseId == $resource->CourseId ? 'selected' : '' }}>{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="ResourceName" class="form-label">Resource Name</label>
<input type="text" class="form-control" id="ResourceName" name="ResourceName" value="{{ $resource->ResourceName }}" required>
</div>
<div class="mb-3">
<label for="ResourceType" class="form-label">Resource Type</label>
<input type="text" class="form-control" id="ResourceType" name="ResourceType" value="{{ $resource->ResourceType }}" required>
</div>
<div class="mb-3">
<label for="ResourceLink" class="form-label">Resource Link</label>
<input type="url" class="form-control" id="ResourceLink" name="ResourceLink" value="{{ $resource->ResourceLink }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Resource</button>
</form>
</div>
@endsection

7. Quiz Views

resources/views/quizzes/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Quizzes</h1>
<a href="{{ route('quizzes.create') }}" class="btn btn-primary mb-3">Add Quiz</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>Course</th>
<th>Quiz Name</th>
<th>Total Marks</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($quizzes as $quiz)
<tr>
<td>{{ $quiz->course->CourseName }}</td>
<td>{{ $quiz->QuizName }}</td>
<td>{{ $quiz->TotalMarks }}</td>
<td>
<a href="{{ route('quizzes.edit', $quiz->QuizId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('quizzes.destroy', $quiz->QuizId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/quizzes/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Quiz</h1>
<form action="{{ route('quizzes.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}">{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="QuizName" class="form-label">Quiz Name</label>
<input type="text" class="form-control" id="QuizName" name="QuizName" required>
</div>
<div class="mb-3">
<label for="TotalMarks" class="form-label">Total Marks</label>
<input type="number" class="form-control" id="TotalMarks" name="TotalMarks" required>
</div>
<button type="submit" class="btn btn-primary"> Create Quiz</button>
</form>
</div>
@endsection

resources/views/quizzes/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Quiz</h1>
<form action="{{ route('quizzes.update', $quiz->QuizId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}" {{ $course->CourseId == $quiz->CourseId ? 'selected' : '' }}>{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="QuizName" class="form-label">Quiz Name</label>
<input type="text" class="form-control" id="QuizName" name="QuizName" value="{{ $quiz->QuizName }}" required>
</div>
<div class="mb-3">
<label for="TotalMarks" class="form-label">Total Marks</label>
<input type="number" class="form-control" id="TotalMarks" name="TotalMarks" value="{{ $quiz->TotalMarks }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Quiz</button>
</form>
</div>
@endsection

8. Grade Views

resources/views/grades/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Grades</h1>
<a href="{{ route('grades.create') }}" class="btn btn-primary mb-3">Add Grade</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>User</th>
<th>Quiz</th>
<th>Marks Obtained</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($grades as $grade)
<tr>
<td>{{ $grade->user->Username }}</td>
<td>{{ $grade->quiz->QuizName }}</td>
<td>{{ $grade->MarksObtained }}</td>
<td>
<a href="{{ route('grades.edit', $grade->GradeId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('grades.destroy', $grade->GradeId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/grades/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Grade</h1>
<form action="{{ route('grades.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}">{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="QuizId" class="form-label">Quiz</label>
<select class="form-select" id="QuizId" name="QuizId" required>
@foreach ($quizzes as $quiz)
<option value="{{ $quiz->QuizId }}">{{ $quiz->QuizName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="MarksObtained" class="form-label">Marks Obtained</label>
<input type="number" class="form-control" id="MarksObtained" name="MarksObtained" required>
</div>
<button type="submit" class="btn btn-primary">Create Grade</button>
</form>
</div>
@endsection

resources/views/grades/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Grade</h1>
<form action="{{ route('grades.update', $grade->GradeId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}" {{ $user->User Id == $grade->User Id ? 'selected' : '' }}>{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="QuizId" class="form-label">Quiz</label>
<select class="form-select" id="QuizId" name="QuizId" required>
@foreach ($quizzes as $quiz)
<option value="{{ $quiz->QuizId }}" {{ $quiz->QuizId == $grade->QuizId ? 'selected' : '' }}>{{ $quiz->QuizName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="MarksObtained" class="form-label">Marks Obtained</label>
<input type="number" class="form-control" id="MarksObtained" name="MarksObtained" value="{{ $grade->MarksObtained }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Grade</button>
</form>
</div>
@endsection

9. Notification Views

resources/views/notifications/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Notifications</h1>
<a href="{{ route('notifications.create') }}" class="btn btn-primary mb-3">Add Notification</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>User</th>
<th>Message</th>
<th>Is Read</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($notifications as $notification)
<tr>
<td>{{ $notification->user->Username }}</td>
<td>{{ $notification->Message }}</td>
<td>{{ $notification->IsRead ? 'Yes' : 'No' }}</td>
<td>
<a href="{{ route('notifications.edit', $notification->NotificationId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('notifications.destroy', $notification->NotificationId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/notifications/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Notification</h1>
<form action="{{ route('notifications.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}">{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="Message" class="form-label">Message</label>
<textarea class="form-control" id="Message" name="Message" required></textarea>
</div>
<div class="mb-3">
<label for="IsRead" class="form-label">Is Read</label>
<select class="form-select" id="IsRead" name="IsRead" required>
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Create Notification</button>
</form>
</div>
@endsection

resources/views/notifications/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Notification</h1>
<form action="{{ route('notifications.update', $notification->NotificationId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}" {{ $user->User Id == $notification->User Id ? 'selected' : '' }}>{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="Message" class="form-label">Message</label>
<textarea class="form-control" id="Message" name="Message" required>{{ $notification->Message }}</textarea>
</div>
<div class="mb-3">
<label for="IsRead" class="form-label">Is Read</label>
<select class="form-select" id="IsRead" name="IsRead" required>
<option value="1" {{ $notification->IsRead ? 'selected' : '' }}>Yes</option>
<option value="0" {{ !$notification->IsRead ? 'selected' : '' }}>No</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Update Notification</button>
</form>
</div>
@endsection

10. Payment Views

resources/views/payments/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Payments</h1>
<a href="{{ route('payments.create') }}" class="btn btn-primary mb-3">Add Payment</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>User</th>
<th>Course</th>
<th>Amount</th>
<th>Payment Date</th>
<th>Payment Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($payments as $payment)
<tr>
<td>{{ $payment->user->Username }}</td>
<td>{{ $payment->course->CourseName }}</td>
<td>{{ $payment->Amount }}</td>
<td>{{ $payment->PaymentDate }}</td>
<td>{{ $payment->PaymentStatus }}</td>
<td>
<a href="{{ route('payments.edit', $payment->PaymentId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('payments.destroy', $payment->PaymentId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/payments/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Payment</h1>
<form action="{{ route('payments.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}">{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}">{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="Amount" class="form-label">Amount</label>
<input type="number" class="form-control" id="Amount" name="Amount" required>
</div>
<div class="mb-3">
<label for="PaymentDate" class="form-label">Payment Date</label>
<input type="date" class="form-control" id="PaymentDate" name="PaymentDate" required>
</div>
<div class="mb-3">
<label for="PaymentStatus" class="form-label">Payment Status</label>
<input type="text" class="form-control" id="PaymentStatus" name="PaymentStatus" required>
</div>
<button type="submit" class="btn btn-primary">Create Payment</button>
</form>
</div>
@endsection

resources/views/payments/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Payment</h1>
<form action="{{ route('payments.update', $payment->PaymentId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}" {{ $user->User Id == $payment->User Id ? 'selected' : '' }}>{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}" {{ $course->CourseId == $payment->CourseId ? 'selected' : '' }}>{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="Amount" class="form-label">Amount</label>
<input type="number" class="form-control" id="Amount" name="Amount" value="{{ $payment->Amount }}" required>
</div>
<div class="mb-3">
<label for="PaymentDate" class="form-label">Payment Date</label>
<input type="date" class="form-control" id="PaymentDate" name="PaymentDate" value="{{ $payment->PaymentDate }}" required>
</div>
<div class="mb-3">
<label for="PaymentStatus" class="form-label">Payment Status</label>
<input type="text" class="form-control" id="PaymentStatus" name="PaymentStatus" value="{{ $payment->PaymentStatus }}" required>
</div>
<button type="submit" class="btn btn-primary">Update Payment</button>
</form>
</div>
@endsection

11. Feedback Views

resources/views/feedback/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Feedback</h1>
<a href="{{ route('feedback.create') }}" class="btn btn-primary mb-3">Add Feedback</a>
@if (session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
<table class="table">
<thead>
<tr>
<th>User</th>
<th>Course</th>
<th>Feedback Content</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($feedbacks as $feedback)
<tr>
<td>{{ $feedback->user->Username }}</td>
<td>{{ $feedback->course->CourseName }}</td>
<td>{{ $feedback->FeedbackContent }}</td>
<td>
<a href="{{ route('feedback.edit', $feedback->FeedbackId) }}" class="btn btn-warning">Edit</a>
<form action="{{ route('feedback.destroy', $feedback->FeedbackId) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection

resources/views/feedback/create.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Add Feedback</h1>
<form action="{{ route('feedback.store') }}" method="POST">
@csrf
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($ users as $user)
<option value="{{ $user->User Id }}">{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}">{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="FeedbackContent" class="form-label">Feedback Content</label>
<textarea class="form-control" id="FeedbackContent" name="FeedbackContent" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Create Feedback</button>
</form>
</div>
@endsection

resources/views/feedback/edit.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Edit Feedback</h1>
<form action="{{ route('feedback.update', $feedback->FeedbackId) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="User Id" class="form-label">User </label>
<select class="form-select" id="User Id" name="User Id" required>
@foreach ($users as $user)
<option value="{{ $user->User Id }}" {{ $user->User Id == $feedback->User Id ? 'selected' : '' }}>{{ $user->Username }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="CourseId" class="form-label">Course</label>
<select class="form-select" id="CourseId" name="CourseId" required>
@foreach ($courses as $course)
<option value="{{ $course->CourseId }}" {{ $course->CourseId == $feedback->CourseId ? 'selected' : '' }}>{{ $course->CourseName }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="FeedbackContent" class="form-label">Feedback Content</label>
<textarea class="form-control" id="FeedbackContent" name="FeedbackContent" required>{{ $feedback->FeedbackContent }}</textarea>
</div>
<button type="submit" class="btn btn-primary">Update Feedback</button>
</form>
</div>
@endsection

This completes the creation of view files for each controller, utilizing Bootstrap 5 for styling and layout.

Each view supports the necessary CRUD operations for the respective models.

Creating a layout view file in Laravel allows you to define a common structure for your application's pages, such as headers, footers, and navigation menus.

Below is an example of a layout view file using Bootstrap 5.

Layout View File

Create a new file named app.blade.php in the resources/views/layouts directory.


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@yield('title', 'My Application')</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('css/app.css') }}">
</ head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="{{ url('/') }}">My Application</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="{{ route('users.index') }}">Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('roles.index') }}">Roles</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('courses.index') }}">Courses</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('syllabus.index') }}">Syllabus</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('live_classes.index') }}">Live Classes</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('resources.index') }}">Resources</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('quizzes.index') }}">Quizzes</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('grades.index') }}">Grades</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('notifications.index') }}">Notifications</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('payments.index') }}">Payments</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('feedback.index') }}">Feedback</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-4">
@yield('content')
</div>
<footer class="bg-light text-center text-lg-start mt-4">
<div class="text-center p-3">
© 2023 My Application
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

This layout file provides a consistent structure for your application, including a navigation bar and footer, while allowing individual views to define their specific content.

To create a dashboard page in your Laravel application that displays consolidated data related to your project, you will need to follow these steps:

Create a Dashboard Controller to handle the logic for fetching the consolidated data.

Create a Dashboard View to display the data.

Define a Route for the dashboard.

Step 1: Create a Dashboard Controller

You can create a new controller for the dashboard using the Artisan command:


php artisan make:controller DashboardController

Step 2: Create a Dashboard View

Create a new view file for the dashboard in the resources/views/dashboard directory. If the directory does not exist, create it.

resources/views/dashboard/index.blade.php


@extends('layouts.app')
@section('content')
<div class="container">
<h1>Dashboard</h1>
<div class="row">
<div class="col-md-4">
<div class="card text-white bg-primary mb-3">
<div class="card-header">Total Users</div>
<div class="card-body">
<h5 class="card-title">{{ $totalUsers }}</h5>
<p class="card-text">Total number of users registered in the system.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-white bg-success mb-3">
<div class="card-header">Total Courses</div>
<div class="card-body">
<h5 class="card-title">{{ $totalCourses }}</h5>
<p class="card-text">Total number of courses available.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-white bg-info mb-3">
<div class="card-header">Total Payments</div>
<div class="card-body">
<h5 class="card-title">${{ number_format($totalPayments, 2) }}</h5>
<p class="card-text">Total amount received from payments.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-white bg-warning mb-3">
<div class="card-header">Total Feedbacks</div>
<div class="card-body">
<h5 class="card-title">{{ $totalFeedbacks }}</h5>
<p class="card-text">Total feedbacks received from users.</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-white bg-danger mb-3">
<div class="card-header">Unread Notifications</div>
<div class="card-body">
<h5 class="card-title">{{ $totalNotifications }}</h5>
<p class="card-text">Total number of unread notifications.</p>
</div>
</div>
</div>
</div>
</div>
@endsection

Step 3: Define a Route for the Dashboard

Open the routes/web.php file and add a route for the dashboard:


use App\Http\Controllers\DashboardController;
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');

Final Steps

Run the Application: Make sure your application is running. You can use the command:


php artisan serve

Access the Dashboard: Navigate to http://localhost:8000/dashboard in your web browser to view the dashboard.

Summary

You have now created a dashboard page that displays consolidated data related to your project, including the total number of users, courses, payments, feedbacks, and unread notifications. The dashboard is styled using Bootstrap 5 for a clean and responsive layout.