A multilingual quiz application for grades 1-8 built with Laravel 12, Livewire 3, and Filament 4.
- Teachers: Full admin access via Filament panel at
/teacher - Students: Dashboard with quiz history and quiz access
- Guests: Anonymous quiz participation
- Grade-based quizzes (1-8)
- Subject categorization
- Multilingual content (Serbian, English, Hungarian)
- Real-time quiz playing
- Score tracking and analytics
- Laravel 12
- Livewire 3 (full-page components)
- Filament 4 (teacher admin panel)
- Tailwind CSS
- MySQL
- PHP 8.2+
- Composer
- Node.js & NPM
- MySQL
- Clone and install dependencies
git clone <repository-url> eduspark
cd eduspark
composer install
npm install- Environment setup
cp .env.example .env
php artisan key:generate- Configure database in
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=eduspark
DB_USERNAME=your_username
DB_PASSWORD=your_password
APP_LOCALE=sr
APP_FALLBACK_LOCALE=sr- Run migrations and seed data
php artisan migrate
php artisan db:seed- Build assets
npm run build- Start the application
php artisan serveusers
- id, name, email, password, role (teacher/student), timestamps
subjects
- id, key (unique), name (JSON), timestamps
quizzes
- id, grade (1-8), subject_id, title (JSON), description (JSON), is_published, timestamps
questions
- id, quiz_id, prompt (JSON), explanation (JSON), order, timestamps
answers
- id, question_id, text (JSON), is_correct, order, timestamps
attempts
- id, user_id (nullable), guest_name (nullable), quiz_id, score, total, started_at, finished_at, locale, timestamps
attempt_answers
- id, attempt_id, question_id, answer_id, is_correct, timestamps
Teacher Account
- Email:
teacher@example.com - Password:
password - Access:
/teacherpanel
Student Account
- Email:
student@example.com - Password:
password - Access:
/dashboard
/- Welcome page with language switcher and quiz start/start- Quiz selection (grade → subject → begin)/quiz/{quiz}- Active quiz playing/quiz/{quiz}/result/{attempt}- Results page
/dashboard- Student dashboard (redirects based on role)/teacher- Teacher Filament panel
sr(Serbian) - Defaulten(English)hu(Hungarian)
- URL query parameter
?lang=xx - Session stored locale
- User preference
- Default (
sr)
All content fields store translations as JSON:
{
"sr": "Српски текст",
"en": "English text",
"hu": "Magyar szöveg"
}- App introduction
- Language switcher
- Start Quiz / Sign In buttons
- Authenticated: Grade selection → Subject selection → Start
- Guest: Name input + Grade + Subject → Start
- Question display with progress
- Answer selection (click/keyboard)
- Auto-advance on answer
- Prevent double submission
- Final score display
- Question review with correct answers
- Play Again / Dashboard navigation
- Quiz history table
- Quick start options
- Personal statistics
- Restricted to users with
role = 'teacher'
- Users - Manage teachers and students
- Subjects - Multilingual subject management
- Quizzes - Grade/subject quizzes with translation support
- Questions - Question bank with explanations
- Answers - Answer options with correctness flags
- Attempts - View quiz attempts and analytics
- Per-locale content editing tabs
- Relation managers for nested data
- Analytics widgets
- Bulk operations
- User selects grade and subject (or provides guest name)
- System creates
attemptsrecord withstarted_at - Redirect to first question
- Display question with answer options
- On answer selection:
- Create
attempt_answersrecord - Calculate correctness
- Auto-advance to next question
- Create
- Prevent back navigation
- Show progress indicator
- On final answer submission:
- Set
finished_attimestamp - Calculate final score
- Redirect to results page
- Set
- Guest:
user_id= null, storeguest_name - Authenticated: Link to user account, track in dashboard
- Access teacher panel at
/teacher - Create subjects with multilingual names
- Create quizzes for each grade/subject combination
- Add 3+ questions per quiz
- Add 4 answers per question (1 correct)
- Publish quizzes
- Enter content in Serbian (primary)
- System auto-copies to English/Hungarian
- Edit other languages as needed
- Fallback to Serbian if translation missing
After running php artisan db:seed, the app includes:
- Mathematics (Математика)
- Serbian Language (Српски језик)
- Science (Природа и друштво)
- English Language (Енглески језик)
- History (Историја)
- One quiz per grade (1-8) × subject combination
- 3 educational questions per quiz
- 4 answer options each (1 correct)
- Appropriate to grade level and subject
# Start development
composer run dev
# Run tests
php artisan test
# Clear caches
php artisan optimize:clear
# Migration commands
php artisan migrate:fresh --seedapp/
├── Models/ # Eloquent models
├── Livewire/ # Full-page components
├── Http/Middleware/ # Locale & Teacher middleware
└── Filament/Teacher/ # Admin panel resources
database/
├── migrations/ # Schema definitions
└── seeders/ # Sample data
resources/
└── views/ # Blade layouts
- Guest quiz completion flow
- Student authentication and dashboard
- Teacher panel access restrictions
- Language switching functionality
- Score calculation logic
- Translation helper methods
- Model relationships
- Role-based access control
- Teacher panel restrictions
- CSRF protection
- Input validation
- Password hashing
- SQL injection prevention
- XSS protection via Blade escaping
- Eager loading relationships
- Query caching for subjects/quizzes
- Asset compilation
- Database indexing on foreign keys
This application is optimized for Laravel Forge deployment:
-
Create Forge Site
- Connect your Git repository
- Configure environment variables
- Set up database and Redis
-
Environment Variables
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com
CACHE_STORE=redis
SESSION_DRIVER=redis
QUEUE_CONNECTION=redis- Deploy Script
Use the included
forge-deploy.shfor automated deployment:
- Pulls latest code
- Installs dependencies
- Builds assets
- Runs migrations
- Warms up cache
- Restarts queue workers
- Queue Configuration Set up queue workers in Forge:
- Command:
php artisan queue:work --sleep=3 --tries=3 --timeout=90 - Processes: 1
- Auto-restart: Yes
For local development using Laravel Herd:
- Install Herd: Download from Laravel Herd website
- Clone Repository:
git clone <repo> && cd eduspark - Install Dependencies:
composer install && npm install - Environment: Copy
.env.exampleto.envand configure - Database: Use Herd's built-in MySQL or external
- Redis: Install Redis locally or use Herd's services
- Build Assets:
npm run devfor development - Access: Use Herd's local domain (e.g.,
eduspark.test)
The application uses web routes exclusively. For API access, consider adding:
- Laravel Sanctum for authentication
- API Resource transformers
- Rate limiting
- API versioning
- Migration errors: Check database connection and permissions
- Asset loading: Run
npm run buildafter changes - Language not switching: Clear browser cache and sessions
- Teacher panel 403: Ensure user has
role = 'teacher'
- Application logs:
storage/logs/laravel.log - Query debugging: Enable
DB_LOG_QUERIES=true
- Follow PSR-12 coding standards
- Write tests for new features
- Update documentation
- Use conventional commits
- Ensure translations are complete
This project is open-sourced under the MIT license.