Download the PHP package eugenefvdm/multi-tenancy-pwa without Composer

On this page you can find all versions of the php package eugenefvdm/multi-tenancy-pwa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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: https://laraveldaily.com/post/filament-sign-in-with-google-using-laravel-socialite)

General Features

PWA (Progressive App Features)

Prerequisites

Packages used

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

Installation

If Filament 4.x is still in beta:

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

Setup

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

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

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

Tenant Model

You'll need the base tenant model:

Model Trait

Add the following trait to your tenant aware models (but not to Tenant.php):

Filament Panel Service Provider

ApplyTenantScopes Middleware

Let's say you have todo and category tables and you want them to automatically get tenant_id. Use this middleware:

The security of your application is your responsbility. Be sure to read this part of the manual: https://filamentphp.com/docs/4.x/users/tenancy#tenancy-security

To automatically assign your tenant id column to every record creation and list view, add Tenant

Next, continue the Filament installation:

Open AdminPanelProvider.php and add this to the end, below the authMiddleware section:

Web Push Notifications

Composer will already be updated with laravel-notification-channels/webpush.

Add the config file:

Example notification:

Database notifications

Laravel 11 and higher:

User Model

Now you can migrate the database

Add Google oAuth credentials

First see: https://fwd.host/ Redirects to: https://herd.laravel.com/docs/macos/advanced-usage/social-auth

Then go to: https://console.cloud.google.com/apis/credentials?pli=1

At Google's URL above, carefully copy out your CLIENT_ID and CLIENT_SECRET top right.

Note: The callback route from Google needs to be wrapped in web for auth()->login to work.

For web push

See: https://laravel-news.com/fwd-host

Logging in

Sign up for a new account:

https://app.test/admin/register

Tenancy tips

Excluding resources from tenancy

As per the manual, you can exclude Filament resources from Tenancy by doing this:

Web push errors

You can simulate this error on the command line on a Mac

But this works:

Socialite Errors

Incorrect Client Secret

Client error: POST https://www.googleapis.com/oauth2/v4/token resulted in a 400 Bad Request response: { "error": "invalid_request", "error_description": "Missing required parameter: code" }

The Client secret is incorrect. It's the bottom value on Google's site.

PWA Images

If you have an SVG, you can resize it here: See: https://pwagenerator.test/

Application Icon Name on Android

short_name in manifest.json


All versions of multi-tenancy-pwa with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^12.0
spatie/laravel-ray Version ^1.40
laravel/socialite Version ^5.21
spatie/eloquent-sortable Version ^4.5
laravel-notification-channels/webpush Version ^10.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eugenefvdm/multi-tenancy-pwa contains the following files

Loading the files please wait ....