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

allow us to configure the table on different connection / database please #84

Open
vesper8 opened this issue Mar 3, 2022 · 4 comments

Comments

@vesper8
Copy link

vesper8 commented Mar 3, 2022

Hello!

As you know me from my heavy usage of your awesome laravel-love library, I like to split my laravel projects into many databases and I'm doing this for one that uses your laravel-ban package.

My bans table is on a different database then my main one. Oddly, methods such as isBanned() do not return any error. To be clear, my bans table is on a different database and the isBanned does correctly return true or false.. so it somehow is capable of interacting with the bans table on a different connection. How this is working right now is a bit puzzling!!

But when I try to actually ->ban() someone I get an error because it's looking for the bans table on the wrong connection.

Would it be possible for you to add a configuration to allow us to set a different connection please?

The same way you did it on laravel-love would be perfect:


'storage' => [
        'database' => [
            'connection' => env('DB_CONNECTION', 'mysql'),

Many many thanks!

@vesper8
Copy link
Author

vesper8 commented Mar 3, 2022

Oh.. right.. it's working because the isBanned method doesn't actually lookup the bans table at all and only looks at the banned_at field.

@antonkomarev
Copy link
Member

Hi @vesper8! So we don't need to do anything at this moment?

@vesper8
Copy link
Author

vesper8 commented Mar 5, 2022

Hi @vesper8! So we don't need to do anything at this moment?

Erm.. sorry if my reply was misleading, I was only explaining why the isBanned is working despite the bans table being on a different database connection. isBanned works because it doesn't care about the bans table and only looks at the model's (users in this case) banned_at column

The ->ban() and ->unban() methods, however, still don't work and still needs the changes suggested above.

@antonkomarev
Copy link
Member

antonkomarev commented Mar 5, 2022

I understand. Unfortunately, I don't have enough time for this at the moment. I spend weekends on https://hype.me improvement and a new secret (🙊) open source application.

@vesper8 I'm ready to review this feature, if you want to bring it in the same way as it done in Laravel Love.

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

No branches or pull requests

2 participants