Compatible with Spatie Multitenancy?

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
billybob
Posts: 1
Joined: 15 Nov 2024, 14:09

Compatible with Spatie Multitenancy?

Post by billybob » 15 Nov 2024, 14:12

Has anyone got this to install or work with Spatie Multitenancy? We have a product using Spatie Multitenancy, and are hitting a road block in trying to get this to install. Mostly because we are using multiple databases, and this package can't find the right one.

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Compatible with Spatie Multitenancy?

Post by aimeos » 15 Nov 2024, 15:41

Aimeos has it's own record base multi-tenancy and doesn't need several databases for that. But you can configure the database it should use here: https://github.com/aimeos/aimeos-larave ... hp#L51-L66
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

lockhart97
Posts: 28
Joined: 17 Aug 2023, 00:16

Re: Compatible with Spatie Multitenancy?

Post by lockhart97 » 27 Feb 2025, 19:49

aimeos wrote: 15 Nov 2024, 15:41 Aimeos has it's own record base multi-tenancy and doesn't need several databases for that. But you can configure the database it should use here: https://github.com/aimeos/aimeos-larave ... hp#L51-L66
The config in `shop.php` for database is static.
I need aimeos to use different database connections for different requests, depending upon the site.

Before the request hits Aimeos, I am determining the site-id and trying to update the database connection for aimeos. I am trying something like this

Code: Select all

		$ctx = new \Aimeos\MShop\Context();
		$dbm = new \Aimeos\Base\DB\Manager\Standard(config('database.connections.test'), 'DBAL');
		$ctx->setDatabaseManager( $dbm );
How can I get/set context of the Aimeos application?

What I require is that, I set the DatabaseManager for AImeos before processing the request.
Is it possible to achieve this scenerio? Can we set database connections for Aimeos dynamically?

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Compatible with Spatie Multitenancy?

Post by aimeos » 28 Feb 2025, 10:03

If you want to use different databases for different clients, why don't you simply create several instances of Aimeos? Having several application instances is no problem any more in cloud environments as they are all cloned from one source.

The Aimeos multi-site feature uses one database for all client sites. You can also use several databases for different data domains (i.e. products, customers, orders, etc.) but those databases contains the data from all clients.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

lockhart97
Posts: 28
Joined: 17 Aug 2023, 00:16

Re: Compatible with Spatie Multitenancy?

Post by lockhart97 » 28 Feb 2025, 15:14

Deploying a separate Aimeos instance for each client would be tedious and difficult to maintain. I'm integrating Aimeos into my existing project, and managing multiple instances while ensuring they all stay on the same version and receive updates consistently would add unnecessary complexity. A multi-tenant setup simplifies deployment, maintenance, and updates across all clients.

User avatar
aimeos
Administrator
Posts: 8616
Joined: 01 Jan 1970, 00:00

Re: Compatible with Spatie Multitenancy?

Post by aimeos » 28 Feb 2025, 15:45

If you want to keep deployment, maintenance, and updates to a bare minimum, then use the existing multi-tenancy feature already offered by Aimeos where all records from all tenants are stored in one database. Spatie-like multi-tenancy with a separate database for each tenant is not supported by Aimeos.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

lockhart97
Posts: 28
Joined: 17 Aug 2023, 00:16

Re: Compatible with Spatie Multitenancy?

Post by lockhart97 » 28 Feb 2025, 15:46

Got it. Thank you.

Post Reply