Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4928 by aimeos
10 Nov 2017, 11:51
Here's the documentation: https://aimeos.org/docs/Laravel/Several_databases

Configure the "db" resource to point to your Aimeos database and the "db-customer" resource to your main database. There will be three tables that are related to the users table (users_address, users_list and users_list_type) which have to stay together with the users table because of the foreign key constraints.
#4967 by schoelli
14 Nov 2017, 11:51
Okay, thanks! How can I migrate the existing shop to the new configuration? Simply rerun php artisan aimeos:setup? Or do I have to copy some tables from the aimeos database to the Laravel project database? Or do I have to setup the shop from scratch?

And are the mshop_customer_* tables also part in the db-customer resource?
#4975 by aimeos
14 Nov 2017, 20:57
After configuring the databases, you can simply run "./artisan aimeos:setup" to create the tables in the new database. If you already added products, you can export and import the table content.

Yes, the mshop_customer* tables belong to the db-customer resource. But they are not used because in Laravel, only the users* tables are used
#5000 by schoelli
16 Nov 2017, 15:23
Thanks, setting up the db-customer configuration and ./artisan aimeos:setup worked. It also keeps my existing product tables untouched.

One thing I noticed is that the mshop_customer* tables are also created in my project database. When I deleted the mshop_customer_group table, aimeos crashed. So there is still a dependency on this table.

An issue I have is that the aimeos admin inferface for editing a customer overwrites the users.name column with the email address of the user. Can I change this behavior?
#5003 by aimeos
16 Nov 2017, 21:14
schoelli wrote:One thing I noticed is that the mshop_customer* tables are also created in my project database. When I deleted the mshop_customer_group table, aimeos crashed. So there is still a dependency on this table.


The mshop_customer_group table is still necessary because it contains the user groups for the Aimeos permission system. It would not make sense to create a users_group table which is only a duplicate of mshop_customers_group.

schoelli wrote:An issue I have is that the aimeos admin inferface for editing a customer overwrites the users.name column with the email address of the user. Can I change this behavior?


You can overwrite the saveItem() method of the customer manager and use a different SQL statement:
- https://github.com/aimeos/ai-laravel/blob/master/lib/custom/src/MShop/Customer/Manager/Laravel.php#L297
- https://github.com/aimeos/ai-laravel/blob/master/lib/custom/config/mshop/customer.php#L275