PHPackages                             eugenefvdm/multi-tenancy-pwa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. eugenefvdm/multi-tenancy-pwa

ActiveLibrary[Framework](/categories/framework)

eugenefvdm/multi-tenancy-pwa
============================

A Laravel package for Filament multi-tenancy &amp; PWA

v0.12(11mo ago)0905MITBlade

Since Jul 1Pushed 11mo agoCompare

[ Source](https://github.com/eugenefvdm/multi-tenancy-pwa)[ Packagist](https://packagist.org/packages/eugenefvdm/multi-tenancy-pwa)[ RSS](/packages/eugenefvdm-multi-tenancy-pwa/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (8)Versions (13)Used By (0)

Multi-tenancy PWA
=================

[](#multi-tenancy-pwa)

A very opinionated setup script for Laravel and Filament PHP to quickly bootstrap a modern multi-tenant aware back office application.

It has PWA features for app installation and web push notifications.

It includes Google Socialite login (compliments of Povilas: )

General Features
----------------

[](#general-features)

- Works with Filament 4 for rapid application development
- Includes a `HasTenantRelationship` trait that may be used to make models tenant aware
- There is ocial login using Google making signing up of new users a breeze

PWA (Progressive App Features)
------------------------------

[](#pwa-progressive-app-features)

- An App installation button
- Web Push notifications
- PWA Diagnostics Screen

Prerequisites
-------------

[](#prerequisites)

- FilamentPHP version 4.x must be installed

Packages used
-------------

[](#packages-used)

The following are presumed to be used and already included in composer:

- Laravel Socialite
- Spatie Eloquent Sortable
- Web push from Laravel Notification Channels

Installation
------------

[](#installation)

### If Filament 4.x is still in beta:

[](#if-filament-4x-is-still-in-beta)

```
composer config minimum-stability beta
composer require filamentphp/filament:4.x
```

```
composer require eugenefvdm/multi-tenancy-pwa
```

### If you're going to be sorting Filament resources any time soon

[](#if-youre-going-to-be-sorting-filament-resources-any-time-soon)

```
php artisan vendor:publish --tag=eloquent-sortable-config
```

Setup
-----

[](#setup)

### Spatie orderable column name

[](#spatie-orderable-column-name)

In `config/eloquent-sortable.php`, change `order_column_name` from `order_colulmn` to `sort`.

If you're using this in your code you'll need both `Sortable` and `SortableTrait`.

### Database migrations for Tenancy

[](#database-migrations-for-tenancy)

Every tenant aware table in your application should have this line:

```
$table->foreignId('tenant_id')->constrained('tenants');
```

To keep things tidy I like putting them after the main ID column.

### Tenant Model

[](#tenant-model)

You'll need the base tenant model:

```
php artisan make:model Tenant -f
```

```
