Production-ready, full-stack School Management System built entirely inside Laravel 12.
- Backend: Laravel 12, Eloquent ORM, MVC, Services, Repositories, Policies, Sanctum
- Frontend: Laravel Blade + Vite + Vanilla JavaScript + modern CSS3 (futuristic dark glassmorphism UI)
- Databases: MySQL (primary) + Microsoft SQL Server (secondary, enterprise sync + cross-DB queries)
- Architecture: Clean MVC + Service/Repository + SOLID + Modular
| Component | Version |
|---|---|
| PHP | 8.2+ |
| Composer | 2.6+ |
| Node.js | 18+ |
| MySQL | 8.0+ (or MariaDB 10.6+) |
| MS SQL Server | 2019+ (Express edition works) |
| PHP extensions | pdo_mysql, pdo_sqlsrv, sqlsrv, openssl, mbstring, intl, fileinfo, xml |
Recommended local stack: XAMPP + SQL Server Express + Microsoft ODBC Driver 18 + Microsoft Drivers for PHP for SQL Server.
# 1) Install dependencies
composer install
npm install
# 2) Configure environment
cp .env.example .env
php artisan key:generate
# Edit .env: set DB_* and SQLSRV_* connection values
# 3) Create databases
# MySQL: CREATE DATABASE sms;
# SQL Server: CREATE DATABASE sms_enterprise;
# 4) Run migrations + seed data
php artisan migrate --seed
# 5) Build assets and run server
npm run dev # in one terminal (Vite)
php artisan serve # in another terminalOpen http://localhost:8000. Sign in with:
| Role | Password | |
|---|---|---|
| Super Admin | admin@sms.local | password |
| Admin | manager@sms.local | password |
- Install XAMPP (PHP 8.2+).
- Start Apache + MySQL from the XAMPP control panel.
- Open http://localhost/phpmyadmin and create database
sms. - Edit
php.iniand enable extensions:extension=pdo_mysql,extension=openssl,extension=fileinfo,extension=mbstring,extension=intl. - Restart Apache.
- Install SQL Server Express and SQL Server Management Studio (SSMS).
- Enable TCP/IP for SQL Server in
SQL Server Configuration Managerand restart the SQL Server service. - Install Microsoft ODBC Driver 18 for SQL Server.
- Install Microsoft Drivers 5.x for PHP for SQL Server matching your PHP version (TS / x64).
- Copy
php_sqlsrv_*.dllandphp_pdo_sqlsrv_*.dllto yourphp/extfolder. - In
php.iniadd:extension=sqlsrv extension=pdo_sqlsrv - Restart Apache and verify with
php -m | findstr sqlsrv. - In SSMS create the database:
CREATE DATABASE sms_enterprise;.
Test the connection from the app:
GET /api/sqlsrv/test (requires Sanctum token)
config/database.php defines two connections:
mysql— primary application data (default)sqlsrv— enterprise SQL Server (read-only by default, used for cross-DB queries and sync jobs)
Set credentials in .env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=sms
DB_USERNAME=root
DB_PASSWORD=
SQLSRV_HOST=127.0.0.1
SQLSRV_PORT=1433
SQLSRV_DATABASE=sms_enterprise
SQLSRV_USERNAME=sa
SQLSRV_PASSWORD=password
- Session auth for Blade UI (
webguard) - Laravel Sanctum tokens for the REST API (
auth:sanctum) - Forgot / reset password flow
- Rate limiting, CSRF, password hashing (
bcrypt) - Role + Permission middleware (
role:,permission:) - Policies for Student, Teacher, Staff, Subject, AcademicYear, Classroom, Section, Exam, User, Role
Read-only console under /query-console (requires access_query_console permission).
- Only
SELECT(andWITH ... SELECT) statements are allowed - Blocked keywords:
INSERT,UPDATE,DELETE,DROP,ALTER,CREATE,TRUNCATE,EXEC(UTE),MERGE,GRANT,REVOKE,RENAME,REPLACE,MODIFY - Multiple statements (
;) blocked - Per-query execution time, row count, success/failure logging in
query_logs - Database selector: MySQL or SQL Server
- Press
Ctrl/Cmd + Enterto run
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/sqlsrv/test |
Test SQL Server connection |
| GET | /api/sqlsrv/students |
Read students from sms_enterprise |
| GET | /api/sqlsrv/teachers |
Read teachers from sms_enterprise |
| POST | /api/sqlsrv/sync |
Trigger sync job (queued, retries) |
| GET | /api/sqlsrv/logs |
Last 100 sync runs |
Sync is executed via App\Jobs\SyncSqlServerJob. Hooked into the scheduler (php artisan schedule:work) to run hourly.
app/
├── Http/
│ ├── Controllers/{Web,Api}/
│ ├── Middleware/{Role,Permission}Middleware.php
│ ├── Requests/
│ └── Resources/
├── Models/
├── Services/
├── Repositories/{Contracts,*Repository}.php
├── Policies/
├── Helpers/
├── Traits/LogsActivity.php
└── Jobs/SyncSqlServerJob.php
resources/
├── views/
│ ├── layouts/{app,sidebar,navbar}.blade.php
│ ├── components/
│ ├── auth/
│ ├── dashboard/
│ └── <module>/{index,create,edit,show}.blade.php
├── css/app.css
└── js/{app,bootstrap}.js
database/
├── migrations/
├── seeders/
└── factories/
routes/
├── web.php
└── api.php
php artisan migrate:fresh --seed # rebuild DB + demo data
php artisan queue:work # process queued jobs (e.g. SQL Server sync)
php artisan schedule:work # run scheduled tasks (hourly sync)
php artisan route:list # list all routes
php artisan make:filament-resource # n/a — UI is pure Blade
npm run build # production assets- Point a vhost at
/public APP_ENV=production,APP_DEBUG=falsephp artisan config:cache route:cache view:cache- Run
npm run buildand commitpublic/build - Set up a daemon to run
php artisan queue:work --tries=3(Supervisor, systemd) - Set up cron entry:
* * * * * cd /path && php artisan schedule:run >> /dev/null 2>&1 - Enable HTTPS, configure CSRF / Sanctum stateful domains
- CSRF on all stateful routes
- XSS-safe Blade templates (
{{ }}escaped) - SQL injection prevention via Eloquent + PDO
- Query Console sanitization (allowlist + statement guard)
- Rate-limited login (Laravel default throttle)
- Role + permission middleware
- Policies for fine-grained model authorization
- Activity logs (
activities) and query logs (query_logs)
Enjoy building 🚀