Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for more connection database #2095

Closed
wants to merge 1 commit into from
Closed

for more connection database #2095

wants to merge 1 commit into from

Conversation

ihyme
Copy link

@ihyme ihyme commented May 16, 2022

No description provided.

@erikn69
Copy link
Contributor

erikn69 commented May 16, 2022

Did you run tests?

Maybe it's a breaking change, because not everybody uses mysql as database(i don't), you could publish and customize migration as you wish

Also, if you want to contribute, at least put a fallback for everybody without 'connection'=>'custom_connection' on their config

-config('permission.connection');
+config('permission.connection') ?: config('database.default');

@erikn69
Copy link
Contributor

erikn69 commented May 16, 2022

Other less intrusive way is putting db name on config, example:

'table_names' => [
    'roles' => 'CUSTOM_DB_NAME.roles',
    'permissions' => 'CUSTOM_DB_NAME.permissions',
    'model_has_permissions' => 'CUSTOM_DB_NAME.model_has_permissions',
    'model_has_roles' => 'CUSTOM_DB_NAME.model_has_roles',
    'role_has_permissions' => 'CUSTOM_DB_NAME.role_has_permissions',
],

It works, test it,
also with env()

'table_names' => [
    'roles' => env('DB_DATABASE', 'CUSTOM_DB_NAME').'.roles',
    ///

'roles' => 'roles',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',

@ihyme
Copy link
Author

ihyme commented May 16, 2022

thank you for enlightening me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants