Skip to content

reidsolon/multi-tenancy

Repository files navigation

Implementing Laravel Multi-Tenancy

Simple implementation laravel tenancy

Prerequisites

  • php8+
  • mysql8+
  • node version 16 up

Technologies Used

Packages used in backend

To Setup

  • cp .env.example .env
  • php artisan key:generate
  • composer i or composer install
  • php artisan migrate:fresh
  • npm i or npm install
  • npm run dev
  • Update .env APP_DOMAIN to what you're using
  • Update .env DB_ configurations

When using custom local domain

  • You need to make sure the custom domain is included in
  • config/tenancy.php > ln:19 central_domains

When creating a user for landlord

  • just run php artisan main:create-user {username} {password?}
  • this command will help you create a master user where you can add tenants

To setup tenancy (you dont need this one, you can create via super admin)

  • php artisan tenancy:install
  • php artisan app:create-tenant {domain} {admin-email?} {admin-password?}
  • First argument is for domain name to be used
  • Second argument is for admin username
  • Third argument is for admin password
  • The command above creates a tenant with admin account to be used during login

About

Multi-tenancy with isolated tenant databases

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published