Backend: - New tenants table with PSGC-derived code, links to cities_municipalities, optional boundary_polygon override, theme color, contact info, timezone. - Adds nullable tenant_id to users / households / drop_off_points / dumpsites / partner_stores. Foreign-keyed, indexed. - Tenant model with deriveCode() helper + effectiveBoundary() fallback chain. - App\Tenancy\Tenancy — process-level current-tenant register with withTenant() / withoutScope() helpers for jobs + super-admin. - App\Tenancy\TenantScope — global Eloquent scope, no-op when no tenant is set (so seeders + super-admin reads still work). - App\Tenancy\HasTenant trait — applied to Household, DropOffPoint, Dumpsite, PartnerStore. Auto-fills tenant_id on create from Tenancy::current(). - ResolveTenant middleware — reads X-Tenant-Code (or X-Tenant-Id), validates tenant exists + active, sets Tenancy::current(). Falls back to authenticated user's tenant_id when header missing. Registered globally on the api group. - Login + register now require an active tenant (super-admin bypasses). Cross-tenant credential reuse is rejected with a 403 + clear message. - super_admin role added to RoleSeeder + users.role enum. - Public GET /api/v1/tenants/lookup?code= — no auth, returns tenant details for the pre-login screen. Seeders: - SuperAdminSeeder seeds super@verde.local (tenant_id = null). - SanPascualTenantSeeder seeds Region IV-A → Batangas → San Pascual municipality → sample Poblacion barangay → Tenant row with code SAN-PASCUAL-BAT, then backfills every existing tenant-aware row (13 users / 2 households / 5 DOPs / 1 dumpsite / 3 stores) so the dev environment keeps working end-to-end. - Wired into DatabaseSeeder so migrate:fresh --seed bootstraps cleanly. Customer-web: - New /tenant page — text input, calls public lookup, confirms with resolved tenant card, stores code + name in cookies (1 year). "Pilot users: SAN-PASCUAL-BAT" hint as a clickable shortcut. - /login + /register now redirect to /tenant?next= when no cookie, show a verde "signing in to <LGU>" pill with a Switch link, delegate the actual form to client components. - /api/tenant route — POST sets cookie, DELETE clears. - apiServer auto-attaches X-Tenant-Code on every API call when the cookie is present. - Tenant cookies are non-httpOnly so the client can echo them; the session token stays httpOnly. Build: 23 routes (added /tenant), 196 backend tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Learning Laravel
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the Laravel Bootcamp, where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, Laracasts can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Partners program.
Premium Partners
- Vehikl
- Tighten Co.
- WebReinvent
- Kirschbaum Development Group
- 64 Robots
- Curotec
- Cyber-Duck
- DevSquad
- Jump24
- Redberry
- Active Logic
- byte5
- OP.GG
Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
License
The Laravel framework is open-sourced software licensed under the MIT license.