isaacdew/laravel-fortify-multitenancy

A package that makes it easy to setup subdomain-based multitenancy with Laravel Fortify.

dev-main 2022-05-02 03:05 UTC

This package is auto-updated.

Last update: 2024-04-30 00:45:47 UTC


README

Installation

composer require isaacdew/laravel-fortify-multitenancy

php artisan vendor:publish --tag=laravel-fortify-multitenancy-migrations

Add the SetTenant middleware to the top of the $middleware property in your Kernel.php:

namespace App\Http;

use Isaacdew\LaravelFortifyMultitenancy\SetTenant;
use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array<int, class-string|string>
     */
    protected $middleware = [
        SetTenant::class,
        // \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        \Illuminate\Http\Middleware\HandleCors::class,
        \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
        ...