DanTheDJ / multitenant

The minimalist Laravel MultiTenant package enables easy multi-tenant applications by dynamically setting the database connection + name and adding a globally available --tenant option to Artisan. Enjoy!
MIT License
14 stars 4 forks source link

Database prefix is not working #4

Closed ArturooTz closed 7 years ago

ArturooTz commented 7 years ago

I noticed that the prefix option stated in the main README is written as:

'tenant_db' => [
...
    'prefix' => 'tenant_', // this can be changed and represents a database prefix e.g. 'business_acme'
...
],

While in TenantResolver.php is written as "database_prefix" instead of "prefix". I noticed because of this line: $databasePrefix = config()->get('database.connections.' . $connection . '.database_prefix');

I changed the option name in database.php to database_prefix and then it worked perfectly (obviously I updated the package with the code from dev-master)

I was wondering if this was just a typo on the readme or if there's something else going on here.

EDIT: Basically the README is outdated right?? I just checked that the latest release is v1.4 and i had no idea, im new to github...

DanTheDJ commented 7 years ago

Hi there,

Apoligies for not keeping the documentation up to date, I have been studying so this has been on the back burner at the moment. I will amend the readme with a explanation of how the package works soon.

The reason you need to change from "prefix" to "database_prefix" is because the "prefix" property represents the table prefix and not the database prefix.

The way you have it setup is correct.

Thanks,

Dan

DanTheDJ commented 7 years ago

Readme has been updated in commit f8d0cfb6