laravel-multi-tenancy

Establish multi-tenant architecture with per-tenant databases in Laravel.

1|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/nextplus896/durra-alaseel --skill laravel-multi-tenancy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-multi-tenancy
Source: https://github.com/nextplus896/durra-alaseel/tree/main/.github/skills/claude-laravel/laravel-multi-tenancy
Command: npx skills add https://github.com/nextplus896/durra-alaseel --skill laravel-multi-tenancy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill establishes a robust multi-tenant architecture pattern for Laravel applications.

Core Features & Use Cases

  • Clear central vs tenanted separation with automatic per-tenant scoping.
  • Database isolation and tenant context helpers to simplify cross-tenant workflows.
  • Use Case: Build a SaaS app where each customer has a separate tenant database and isolated data access.

Quick Start

Install Laravel and Stancl Tenancy, configure central and tenanted routes, and run a sample tenant scenario.

Frequently Asked Questions about laravel-multi-tenancy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up multi-tenant database isolation in a Laravel application?

Multi-tenant database isolation in Laravel is achieved by separating central and tenanted routes, using per-tenant databases, and applying automatic query scoping to ensure data separation. The pattern uses the Stancl Tenancy package to manage contexts.

What is the difference between central vs tenanted routes in Laravel multi-tenancy?

In Laravel multi-tenancy, central routes handle global application logic, while tenanted routes automatically scope database queries to a single tenant's isolated database. This separation simplifies cross-tenant workflows and ensures strict data isolation.

Do I need Composer and Stancl Tenancy to build a Laravel SaaS app?

Yes, implementing this multi-tenant Laravel architecture requires a standard PHP and Laravel environment with Composer dependencies, specifically the Stancl Tenancy package. It provides the automatic query scoping and tenant context helpers needed for a SaaS application.

How do I scope database queries automatically for each tenant in Laravel?

You scope database queries automatically by configuring tenant context helpers within tenanted routes. This establishes a robust multi-tenant architecture pattern that applies per-tenant scoping to all database operations within that tenant's context.

What is the best way to handle cross-tenant workflows in Laravel?

Handling cross-tenant workflows in Laravel is managed using tenant context helpers alongside clear central vs tenanted separation. This allows interaction with central databases and individual tenant databases without breaking isolation boundaries.