taufik-khatik/laravel-multi-tenant ? reverse-engineered prompt

Reverse engineered prompt

Build me a Laravel 11 starter app for single database multi tenancy with subdomain based tenant detection.

I want companies to log in from their own subdomain, like acme.example.com, and only see their own users and orders. Please set up the tenants table, add tenant_id to the right models and tables, and make the app automatically filter every query by the current tenant so nobody can access another tenant’s data by accident. Use a middleware to read the subdomain and load the tenant, a reusable model trait so new models can easily belong to a tenant, and a global scope so the tenant filter happens automatically. Also include example models, migrations, seed data, routes, and a few simple API style examples for creating and listing records. Make it production ready, but keep it easy to understand and run locally. If anything needs current Laravel guidance, look it up online first.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab