A comprehensive REST API built with Laravel 11 for managing scholarship applications, submissions, and user profiles.
- User registration with strong password validation
- Secure login with Laravel Sanctum tokens
- Role-based access control (Student, Institute Admin, University Admin, Admin, Super Admin)
- Token-based API authentication
- CRUD operations for scholarships
- Role-based scholarship visibility
- Advanced filtering (type, university, institute, search)
- Pagination support
- Multiple scholarship types (Government, Private, University, Institute)
- Submit scholarship applications
- Track application status (Pending, Under Review, Approved, Rejected)
- Document upload support
- GPA and personal statement tracking
- Admin review and status management
- Comprehensive user profiles
- Education details
- Personal information
- Career goals
Controller β Service β Model β Database
β β
Form Request Response
Validation Resource
- Controllers: Handle HTTP requests/responses
- Services: Contain business logic and data operations
- Form Requests: Validate incoming data
- Resources: Transform models to consistent JSON
- Middleware: Authentication and authorization
- PHP 8.2 or higher
- Composer
- MySQL 5.7+ or SQLite
- Laravel 11.x
cd backend
composer installcp .env.example .env
php artisan key:generateUpdate .env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=scholarship_db
DB_USERNAME=your_username
DB_PASSWORD=your_passwordphp artisan migratephp artisan db:seedphp artisan serveAPI available at: http://localhost:8000/api
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout (auth required)GET /api/auth/me- Get current user (auth required)
GET /api/scholarships- List scholarships (public)GET /api/scholarships/{id}- Get scholarship details (public)POST /api/scholarships- Create scholarship (admin only)PUT /api/scholarships/{id}- Update scholarship (admin only)DELETE /api/scholarships/{id}- Delete scholarship (admin only)
GET /api/applications- List applications (auth)GET /api/applications/my-applications- My applications (auth)GET /api/applications/{id}- Get application (auth)POST /api/applications- Submit application (auth)PUT /api/applications/{id}- Update application (auth)DELETE /api/applications/{id}- Delete application (auth)
GET /api/profile- Get profile (auth)PUT /api/profile- Update profile (auth)
All protected endpoints require a Bearer token:
Authorization: Bearer {your-token}
Register:
curl -X POST http://localhost:8000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"password": "SecurePass123!",
"password_confirmation": "SecurePass123!",
"category": "undergraduate"
}'Login:
curl -X POST http://localhost:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"password": "SecurePass123!"
}'| Role | Permissions |
|---|---|
| Student | View scholarships, submit applications, manage own profile |
| Institute Admin | Manage institute scholarships, review institute applications |
| University Admin | Manage university scholarships, review university applications |
| Admin | Manage all scholarships and applications |
| Super Admin | Complete system access |
Import the collection from postman/ScholarSnap_API.json
php artisan testphp artisan test --filter=AuthenticationTest
php artisan test --filter=ScholarshipTestbackend/
βββ app/
β βββ Http/
β β βββ Controllers/Api/
β β β βββ AuthController.php
β β β βββ ScholarshipController.php
β β β βββ ApplicationController.php
β β β βββ ProfileController.php
β β βββ Requests/
β β β βββ LoginRequest.php
β β β βββ RegisterRequest.php
β β β βββ StoreScholarshipRequest.php
β β β βββ UpdateScholarshipRequest.php
β β β βββ StoreApplicationRequest.php
β β β βββ UpdateApplicationRequest.php
β β βββ Resources/
β β βββ UserResource.php
β β βββ ScholarshipResource.php
β β βββ ApplicationResource.php
β βββ Services/
β β βββ AuthService.php
β β βββ ScholarshipService.php
β β βββ ApplicationService.php
β βββ Models/
β βββ User.php
β βββ Scholarship.php
β βββ Application.php
β βββ University.php
β βββ Institute.php
βββ routes/
β βββ api.php
βββ database/
β βββ migrations/
βββ Documentation/
βββ API_DOCUMENTATION.md
βββ QUICK_START.md
βββ REFACTORING_SUMMARY.md
- β Password hashing with bcrypt
- β Strong password requirements
- β Compromised password checking
- β Token-based authentication (Laravel Sanctum)
- β Role-based authorization
- β Input validation with Form Requests
- β SQL injection protection (Eloquent ORM)
- β XSS protection
- β CORS configuration
php artisan cache:clear
php artisan config:clear
php artisan route:clearphp artisan route:listphp artisan tinker$user = User::find(1);
$token = $user->createToken('test-token')->plainTextToken;
echo $token;tail -f storage/logs/laravel.logusers- User accounts and authenticationscholarships- Scholarship opportunitiesapplications- Student applicationsuniversities- University informationinstitutes- Institute/College information
University β hasMany β Institutes
University β hasMany β Scholarships
Institute β hasMany β Scholarships
User β hasMany β Applications
Scholarship β hasMany β Applications
401 Unauthorized
- Check if token is included in Authorization header
- Verify token is valid and not expired
422 Validation Error
- Check request body matches validation rules
- Review error messages for specific field issues
403 Forbidden
- Verify user role has permission for the action
- Check role-based middleware configuration
500 Server Error
- Check
storage/logs/laravel.logfor details - Verify database connection
- Ensure all required environment variables are set
Update config/cors.php to allow your frontend origin:
'allowed_origins' => ['http://localhost:5173'],- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License.
For detailed documentation:
- Authentication system
- Scholarship CRUD operations
- Application submission
- Role-based access control
- Profile management
- File upload for documents
- Email notifications
- Admin dashboard analytics
- Advanced search filters
- Export to PDF
- Real-time notifications
- Multi-language support
Built with β€οΈ using Laravel 11
Version: 1.0.0
Last Updated: October 11, 2025