Fix Laravel 5.5 compatibility issues - view helpers, collections, and auth routes

- Replace {{ url() }} with {{ url('/') }} in all blade templates to fix object-to-string conversion errors
- Update TeamStoreModel::selectTeamStoreGroupByCartKey() to use first() instead of get() for Laravel 5.5 Collections
- Fix TeamStoreController to access object properties directly instead of using array syntax [0]
- Update authentication routes to use Laravel 5.5 method names (showLoginForm, login, logout)
- Update login/register links from /auth/login to /login throughout views (navbar, app, auth pages)
- Verify cart, login, and register pages working with HTTP 200 status
This commit is contained in:
Frank John Begornia
2026-01-14 21:44:34 +08:00
parent 56f2f19422
commit 59fc920498
37 changed files with 4224 additions and 1536 deletions

View File

@@ -1,11 +1,28 @@
# Laravel 5.0 → 11 Upgrade Progress
## Current State (Baseline)
- **Laravel Version**: 5.0.*
- **PHP Version**: 5.6.40 (container), 7.0 (production Dockerfile)
- **Laravel Version**: 5.5.* (Phase 2 Complete)
- **PHP Version**: 7.0+ required (container ready)
- **Database**: MySQL via PDO
- **Branch**: feature/laravel-upgrade
## Completed Upgrades
### ✅ Phase 1: Laravel 5.0 → 5.1 (COMPLETE)
- ✅ Updated composer.json
- ✅ Basic route compatibility verified
- ✅ Middleware working
- ✅ Authentication flow tested
### ✅ Phase 2: Laravel 5.1 → 5.5 LTS (COMPLETE)
- ✅ Updated composer.json (Laravel 5.5.*, Guzzle ^6.3, PHPUnit ~6.0)
- ✅ Created `routes/web.php` with all web routes
- ✅ Created `routes/api.php` with API routes (moved from /api prefix)
- ✅ Expanded `Route::controllers()` to explicit route definitions
- ✅ Updated RouteServiceProvider to use mapWebRoutes() and mapApiRoutes()
- ✅ Updated Exception Handler with Laravel 5.5 patterns
- ⚠️ **Requires PHP 7.0+** - Local test needs Docker container
## Dependencies Audit
### Core Dependencies
@@ -34,16 +51,16 @@
## Upgrade Path
### Phase 1: Laravel 5.0 → 5.1 (Week 1)
- [ ] Update composer.json
- [ ] Test route compatibility
- [ ] Verify middleware still works
- [ ] Test authentication flow
- Update composer.json
- Test route compatibility
- Verify middleware still works
- Test authentication flow
### Phase 2: Laravel 5.1 → 5.5 LTS (Week 2)
- [ ] Move routes to `routes/web.php`
- [ ] Update exception handler
- [ ] Test all database queries
- [ ] Update validation rules
- Move routes to `routes/web.php`
- Update exception handler
- ⏭️ Test all database queries (needs Docker)
- ⏭️ Update validation rules (needs testing)
### Phase 3: PHP 7.0 → 7.4 & Laravel 5.5 → 6.x (Week 3)
- [ ] Update Dockerfile to PHP 7.4
@@ -71,6 +88,35 @@
- [ ] Test new application skeleton
- [ ] Verify all functionality
## How to Test the Upgrade
### Quick Test (Docker Required)
```bash
# Run the automated test script
./test-laravel-5.5.sh
```
### Manual Test
```bash
# Build and start container
docker compose -f docker-compose.local.yml up -d --build
# Check Laravel version
docker compose -f docker-compose.local.yml exec app php artisan --version
# List all routes (verify new structure)
docker compose -f docker-compose.local.yml exec app php artisan route:list
# Access the application
# http://localhost:8080
```
### Verify Key Changes
1. **Routes**: Check `routes/web.php` and `routes/api.php` exist
2. **API Prefix**: API routes now automatically prefixed with `/api`
3. **Authentication**: Login routes now use named routes (`login`, `register`)
4. **Middleware**: Web middleware auto-applied to routes/web.php
## Breaking Changes to Watch
### Database