# Upgrade Report

Date: 2026-02-26

## Current to Target

- Legacy detected: Laravel `5.2.*`, PHP `>=5.5.9`
- Target selected: Laravel **12.x** (latest stable at execution time)
- PHP target: `^8.2`
- Local runtime observed: PHP `8.5.2`

## Detection Source for Target Major

Laravel official release/support documentation indicates Laravel 12 is stable and Laravel 13 is upcoming (not yet stable) as of 2026-02-26.

## What Changed

### Framework and Tooling

- Replaced project `composer.json` for Laravel 12-era dependencies.
- Added composer scripts:
  - `test`: `php artisan test`
  - `lint`: `vendor/bin/pint`
  - `analyse`: `vendor/bin/phpstan analyse`
- Modernized bootstrap and routing entrypoints:
  - `bootstrap/app.php` (application builder)
  - `routes/web.php`, `routes/api.php`, `routes/console.php`
- Updated environment/testing/tooling files:
  - `.env.example`, `phpunit.xml`, `.pint.json`, `phpstan.neon`

### Architecture Refactor

- Added domain models under `app/Models`.
- Added Actions/Services/DTOs:
  - `CreateBookingAction` with transaction + overlap locking
  - listing create/update/publish actions
  - `TransitionBookingStatusAction`
  - `AvailabilityService` and `PricingService`
- Added Form Requests for auth/profile/listing/booking validation.
- Added policies and authorization gates for host/admin/member boundaries.
- Added JSON API resources for `/api/v1/listings`.

### Database Normalization

- Added full migration chain for listings, availability, bookings, payments, favorites, reviews, vehicles, plus supporting infra tables.
- Kept legacy `users` migration and applied additive user columns migration.
- Added complete factory set and ordered seeders producing Metro Manila-like data.

### Web and Dashboard UI

- Blade public pages:
  - landing
  - directory
  - listing detail with booking CTA and weekly availability preview
- Livewire components:
  - directory filtering/pagination
  - member bookings dashboard
  - host listing manager + availability rule input
- Admin dashboard route protected by authorization.

### API Readiness (V2 mobile)

- Added `GET /api/v1/listings`
- Added `GET /api/v1/listings/{listing}`
- Added `sanctum` config and token table migration
- Kept business logic in actions/services for web/API reuse

## Breaking Changes / Important Differences

1. Legacy raw-SQL table model replaced by normalized migration-first schema.
2. Legacy `users_groups` role mapping replaced with `users.role`.
3. Legacy auth controllers (`Route::auth`) replaced with explicit modern session auth controllers.
4. Legacy Google mapper integration removed from runtime flow.
5. Booking lifecycle now enforces strict overlap blocking and status transition rules.

## Manual Steps Required

1. Run dependency install (`composer install`) once network access is available.
2. Generate app key and storage symlink.
3. Run migrations and seeders.
4. Run full quality gate: test, lint, analyse.
5. Verify host/admin/member route guards in browser.
6. Verify booking overlap and status transition behavior manually.

## Risks and Open Items

1. Dependency resolution was not executable in this environment (DNS to packagist unavailable), so package install compatibility is prepared but unverified at install time.
2. Legacy production data migration (from old tables like `parking_spaces*`, `users_groups`) still needs ETL scripts outside this repository.
3. Filament resources are dependency-planned; admin route security exists, but full Filament panel generation should be finalized after package install.

## Test Strategy Implemented

- Feature tests for:
  - public browsing
  - register/login/logout
  - host create/publish/availability flow
  - booking overlap prevention + status transitions
  - authorization boundaries
- Unit tests for:
  - booking overlap action behavior
  - weekly availability with exceptions
- Livewire tests for:
  - directory filters/pagination
  - host listing create/edit validation
