JosephSilber / bouncer

Laravel Eloquent roles and abilities.
MIT License
3.43k stars 330 forks source link

Migration issues using Multitenancy System #641

Open undjike opened 11 months ago

undjike commented 11 months ago

Hello Team,

First of all, thanks for the brillant job you achieved. It's really well implemented and time saving.

Nevertheless, I'm facing issues using the package in a multitenancy system where there is a permission management in each tenant database and also in the landlord database (means 02 levels of permission management implemented via 02 database connections).

First, I'm forced to use class name in the migration file generated by the package. When I convert it to anonymous class syntax, I get errors running migrations.

Second, I have a dedicated folder for tenant migrations and landlord migrations located the usual place. When running migrations (forced to use class name syntax), I get an error too.

image

So, my questions are:

  1. Why not make use of anonymous class syntax for the package migration?
  2. Is it possible to specify the connection used by the Bouncer facade?
robinlecouteur commented 11 months ago

I'm just cruising through, but have you tried naming the migration to TenantCreateBouncerTables or something? Also what is the exact error you get when using anonymous class?

digitlimit commented 10 months ago

@undjike have you resolved this issue?

undjike commented 10 months ago

I haven't. Do you face the same issue?

digitlimit commented 10 months ago

@undjike Yes, building tenancy application with https://github.com/archtechx/tenancy

undjike commented 10 months ago

@undjike yes, building tenancy application with https://github.com/archtechx/tenancy

I was using the same...

digitlimit commented 10 months ago

@undjike I am wondering if I can fix and submit a PR for this. I believe anonymous migration classes work in Laravel 7 >=

undjike commented 10 months ago

I think it's from >=8.

undjike commented 10 months ago

https://laravel-news.com/laravel-anonymous-migrations