A comprehensive Laravel 11 Student Portal with complete academic management system, examination platform, and institutional administration features.
- Manual RBAC implementation (no external packages)
- Three user roles: Admin, Lecturer, Student
- Granular permission system
- Middleware and gate-based authorization
- Automatic student role assignment on registration
- Grade Management: Complete gradebook system with GPA calculation and academic standing
- Attendance Tracking: Daily attendance recording with sessions and analytics
- Assignment System: File upload, grading, and feedback system
- Progress Reports: Comprehensive student performance tracking with PDF export
- Academic Calendar: Event management, scheduling, and holiday periods
- Course Scheduling: Timetable management with conflict detection
- Server-side timer with precise duration tracking
- Browser timer synchronization with real-time updates
- Automatic submission when time expires
- Multiple question types: MCQ, True/False, Essay, Short Answer
- Question bank management with advanced options
- Exam scheduling with calendar view
- Proctoring and monitoring capabilities
- Exam statistics and performance analytics
- Department Management: Complete department administration system
- Library System: Resource management with borrowing and reservations
- Communication System: Messaging, announcements, and notifications
- Analytics Dashboard: Real-time metrics and comprehensive reporting
- Bulk Operations: Mass student management and data export
- Mobile-first design with responsive layouts
- Touch-optimized interface for all features
- Device detection with automatic view selection
- Bottom navigation and mobile-friendly interactions
- Progressive enhancement for all device types
- Admin Dashboard: System statistics, user management, academic oversight
- Student Dashboard: Academic progress, assignments, exams, grades
- Lecturer Dashboard: Subject management, class overview, grading, analytics
- Responsive design with Tailwind CSS
- Livewire Volt components for reactive interface
- Real-time updates without page refreshes
- Intuitive navigation with role-based menu items
- Progress indicators and status notifications
- Search functionality across all modules
- Dark mode support for all interfaces
- Backend: Laravel 11 with PHP 8.3
- Frontend: Livewire 3 + Volt + Tailwind CSS 3
- Database: SQLite (default) with Eloquent ORM
- Testing: PHPUnit 11 with comprehensive coverage
- Build Tool: Vite with HMR support
- Authentication: Laravel Breeze with email verification
- PHP: 8.2 or higher
- Composer: Latest version
- Node.js: 16+ and NPM
- Database: SQLite (default), MySQL 8+, PostgreSQL 12+
- Web Server: Apache 2.4+ or Nginx
- SSL: Required for production (Let's Encrypt recommended)
git clone <repository-url>
cd yp-student-portal# Install PHP dependencies
composer install
# Install Node.js dependencies
npm install# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generate
# Configure environment variables
nano .env # Or your preferred editor# IMPORTANT: Set your local timezone
APP_TIMEZONE=Asia/Kuala_Lumpur # Change to your timezone
# Other timezone examples:
# APP_TIMEZONE=America/New_York
# APP_TIMEZONE=Europe/London
# APP_TIMEZONE=Asia/Singapore
# APP_TIMEZONE=Australia/Sydney# Run migrations with seeding (creates admin, lecturer, and student accounts)
php artisan migrate:fresh --seed
# For development: Use SQLite (default)
# For production: Configure MySQL/PostgreSQL in .env# Development build with HMR
npm run dev
# Production build (optimized)
npm run build# Full development environment (recommended)
composer run dev
# Or run individual services:
php artisan serve # Laravel development server (http://localhost:8000)
npm run dev # Vite HMR for frontend
php artisan queue:listen # Queue worker for background jobs
php artisan pail # Log monitoringVisit http://localhost:8000 and test with default credentials:
| Role | Password | |
|---|---|---|
| Admin | admin@example.com | password |
| Lecturer | lecturer@example.com | password |
| Student | student@example.com | password |
If you encounter problems with examination timing (e.g., exams showing incorrect start/end times):
-
Check your timezone setting in
.env:APP_TIMEZONE=Asia/Kuala_Lumpur # Set to your local timezone -
Clear configuration cache after changing timezone:
php artisan config:clear
-
Available timezones (find yours at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones):
Asia/Kuala_Lumpur(Malaysia/Singapore)Asia/Singapore(Singapore)America/New_York(Eastern Time)America/Los_Angeles(Pacific Time)Europe/London(UK)Australia/Sydney(Australia)
If students can't see examinations:
- Verify student enrollment in a class with subjects
- Check examination is active and published
- Confirm start/end times are correct for your timezone
- Ensure student has
take_examinationspermission
- PHP: 8.2+ with required extensions
- Database: MySQL 8+ or PostgreSQL 12+
- Web Server: Apache 2.4+ or Nginx
- SSL Certificate: Required for secure connections
- File Storage: Adequate space for uploads and logs
# Production environment settings
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com
# Database configuration
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=student_portal
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password
# Mail configuration (for notifications)
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="noreply@your-domain.com"
# File storage
FILESYSTEM_DISK=local
AWS_ACCESS_KEY_ID=your-access-key # For S3 if using
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket-name
AWS_USE_PATH_STYLE_ENDPOINT=false
# Cache and session configuration
CACHE_DRIVER=database
SESSION_DRIVER=database
QUEUE_CONNECTION=database# Pull latest code
git pull origin main
# Install/update dependencies
composer install --no-dev --optimize-autoloader
npm ci --production
# Run migrations
php artisan migrate --force
# Optimize Laravel
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache
# Build assets
npm run build
# Set permissions
chmod -R 775 storage
chmod -R 775 bootstrap/cache
# Restart services (if using queue workers)
php artisan queue:restartRecommended for production:
- Laravel Forge: Automated server management
- Envoyer: Zero-downtime deployment
- Vapor: Serverless deployment
<VirtualHost *:80>
ServerName your-domain.com
Redirect permanent / https://your-domain.com/
</VirtualHost>
<VirtualHost *:443>
ServerName your-domain.com
DocumentRoot /var/www/yp-student-portal/public
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/privkey.pem
<Directory /var/www/yp-student-portal/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>server {
listen 80;
server_name your-domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name your-domain.com;
root /var/www/yp-student-portal/public;
index index.php;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/privkey.pem;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
}# Create storage symlink (if needed)
php artisan storage:link
# Clear caches
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
# Schedule setup (add to crontab)
* * * * * cd /var/www/yp-student-portal && php artisan schedule:run >> /dev/null 2>&1
# Queue worker setup (for background jobs)
# Use Supervisor or systemd for process management# Set proper file permissions
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod -R 775 storage bootstrap/cache
# Update .env with secure values
# - Change default passwords
# - Use strong APP_KEY
# - Configure secure mail settings
# - Set up proper file permissions# Regular maintenance commands
php artisan backup:run # If using laravel-backup
php artisan queue:work # Process queued jobs
php artisan schedule:run # Run scheduled tasks
php artisan log:clear # Clear old logs
php artisan cache:clear # Clear cache- Database: Daily automated backups
- Files: Regular backup of storage directory
- Configuration: Backup .env file
- Code: Version control with Git
# Enable OPcache
# Configure Redis for caching
# Use CDN for static assets
# Enable gzip compression
# Implement proper database indexing| Role | Password | |
|---|---|---|
| Admin | admin@example.com | password |
| Lecturer | lecturer@example.com | password |
| Student | student@example.com | password |
app/
βββ Models/ # Eloquent models
β βββ User.php # User model with RBAC methods
β βββ Role.php # Role model
β βββ Permission.php # Permission model
β βββ Examination.php # Examination model with subject relationship
β βββ ExaminationAttempt.php # Attempt tracking
β βββ Subject.php # Subject model
β βββ ClassModel.php # Class model with student enrollment
β βββ Question.php # Questions model with advanced options
β βββ QuestionOption.php # Question options with relational storage
β βββ Answer.php # Answer model
βββ Http/
β βββ Controllers/
β β βββ ExaminationController.php
β β βββ AdminController.php
β β βββ StudentDashboardController.php
β β βββ LecturerDashboardController.php
β β βββ SubjectController.php
β β βββ ClassController.php
β β βββ EnrollmentController.php
β βββ Middleware/
β βββ PermissionMiddleware.php
β βββ RoleMiddleware.php
βββ Providers/
β βββ AuthServiceProvider.php # Gates and policies
βββ View/
βββ Components/ # Blade components
database/
βββ migrations/ # Database schema
βββ seeders/ # Sample data
βββ factories/ # Test data generation
resources/
βββ views/
β βββ admin/ # Admin dashboard views
β βββ student/ # Student dashboard views
β βββ lecturer/ # Lecturer dashboard views
β βββ examinations/ # Examination views
β βββ subjects/ # Subject management views
β βββ classes/ # Class management views
β βββ enrollment/ # Student enrollment views
β βββ livewire/ # Livewire components
β βββ examinations/ # Examination components
β βββ layout/ # Navigation components
βββ js/
βββ examination-timer.js # Timer synchronization
tests/
βββ Feature/ # Feature tests
βββ Unit/ # Unit tests
βββ TestCase.php # Base test case
- Relational Question Options: Migrated from JSON to relational table structure for better data integrity
- Subject-Based Organization: Examinations categorized by subjects with filtering capabilities
- Role-Based Navigation: Dynamic navigation showing relevant options based on user roles
- One-to-Many with Constraints: Flexible many-to-many relationships with one-to-one enforcement where needed
- Comprehensive Relationships: Well-defined Eloquent relationships across all models
- User-Role-Permission relationships
- Dynamic permission checking
- Role-based middleware
- Gate definitions for common operations
- Policy-based authorization ready
- Timer synchronization between server and browser
- Auto-save functionality for answers
- Real-time progress tracking
- Automatic submission on timeout
- Results calculation and display
- Question navigation with progress indicators
- Subject-based filtering and organization
- Advanced question options with relational storage supporting:
- Multiple correct answers
- Weighted scoring per option
- Better data integrity with foreign key constraints
- Improved querying and analytics capabilities
- System statistics dashboard
- User management with role assignment
- Role-permission management
- Examination management (lecturers)
- Results viewing (admin/lecturers)
- Class enrollment status and management
- Upcoming examinations based on enrolled subjects
- Available examinations with subject filtering
- Recent examination results and performance tracking
- Academic statistics (exams completed, average score, passed exams)
- Subject management and overview
- Class management with student enrollment tracking
- Examination creation and management
- Student result analysis and performance tracking
- System analytics and reporting
Run the test suite:
# Run all tests
php artisan test
# Run specific test file
php artisan test tests/Feature/ExaminationTest.php
# Run with coverage
php artisan test --coverage- RBAC functionality (role/permission management)
- Examination system (timer, submission, results)
- Authentication (registration, login, access control)
- Admin features (dashboard, user management)
- Student enrollment (class/subject management)
- Question options (relational storage, multiple correct answers)
- Role-based dashboards (student/lecturer/admin views)
- Subject-based examinations (filtering and categorization)
- API endpoints (examination APIs)
# Development
composer run dev # Full development environment
php artisan serve # Laravel server
npm run dev # Vite HMR
php artisan queue:listen # Queue worker
php artisan pail # Log monitoring
# Database
php artisan migrate # Run migrations
php artisan db:seed # Seed database
php artisan migrate:fresh # Fresh migration
php artisan tinker # Interactive shell
# Testing
php artisan test # Run tests
php artisan test --filter=testName
vendor/bin/pint --dirty # Code formatting
# Build
npm run build # Production build
npm run dev # Development build- Laravel Pint for code formatting
- Strict type declarations throughout
- PSR-12 coding standards
- Comprehensive test coverage
- Model factories for test data
# Build assets
npm run build
# Optimize Laravel
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Set up production database
php artisan migrate --force
php artisan db:seed --forceAPP_ENV=production
APP_DEBUG=false
APP_URL=https://your-domain.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"- Role-based access control (RBAC)
- Permission-based authorization
- Email verification support
- Password confirmation for sensitive actions
- CSRF protection enabled
- SQL injection prevention with Eloquent
- XSS protection with Blade templating
- Rate limiting on authentication routes
- Database indexing on foreign keys and unique columns
- Eager loading to prevent N+1 queries
- Query caching for frequently accessed data
- Asset optimization with Vite
- Response caching where appropriate
- Lazy loading for large datasets
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PSR-12 coding standards
- Use strict type declarations
- Write tests for new features
- Run code formatting before committing
- Update documentation as needed
- Laravel - The PHP Framework for Web Artisans
- Livewire - Full-stack framework for Laravel
- Tailwind CSS - Utility-first CSS framework
- Volt - Single-file Livewire components
For support and questions:
- Create an issue in the repository
- Check the Laravel documentation
- Review the Livewire documentation