Help with Tenancy With Laravel Package
guys i need help with setting up multi database architecture using tenancy with Laravel package, if you can provide a full guide for setting up database.php , tenancy.php and .env connection i would highly appreciate it
Solution:Jump to solution
thanks for @Geoff. and his efforts we managed to make a gist with a full guide to implement multi-tenancy with multiple database approach
here is the link for the gist
https://gist.github.com/Hegabovic/81d63f16dcceac16ecbdd0c3722857ae
now we can close this question as resolved ✅...
Gist
Full Guide for Multi-tenancy with tenancy with laravel package
Full Guide for Multi-tenancy with tenancy with laravel package - multi-tenancy.md
66 Replies
never had to setup multi database
but its all in the midelwear
this may help
https://discord.com/channels/883083792112300104/1152246454581219388
i was ther ebut i still need some help
Start with following the package you are using’s setup instructions. Then comeback to Filament. You’re getting into a pretty complicated thing and you’ll need a solid understanding of this type of tenancy before even worrying about making it work with filament.
actually i understand it pretty good, but the thing is there is no configuration guide for it
Wish I could help more. But it’s just not my strong suit.
thanks a lot for even trying to help 😄 i really appreciate it 😄
i finally managed to make it work but the design are not loaded even if i ran npm run dev or npm run build
check the console for errors
make sure the app_url in env file is currect
but idk what is that !
in
.env
file
check
APP_URL=https://site.test
it is the APP_URL=http://localhost:8000
not sure how tenancy package will handle the vendor assets
check the
Assets
section here
https://tenancyforlaravel.com/docs/v3/tenancy-bootstrappers/#filesystem-tenancy-boostrapperTenancy for Laravel
Tenancy bootstrappers | Tenancy for Laravel
Tenancy bootstrappers | Tenancy for Laravel
also
Configuring the asset URL (ASSET_URL in your .env)
for me I recommend disable tenancy of asset() unless you absolutely need it
ok i will look into it , thanks a lot 😄
setting helped for me
yeah i actually worked perfectly , the only issue i have now is the main site which is localhost:8000 is giving me that error and i cant access it
did you set your central domain
yup to localhost
you also have the routes and stuff?
in the web.php i put the default laravel view , but it gets me the error i provided before
but did you follow this https://tenancyforlaravel.com/docs/v3/installation
yup word bu word , letter by letter 😄
Can you show me your routeserviceprovider
hmm
did you add te InitializeTenancyByDomain::class provider to your panel?
no i can't find it in my panel but what is it , and where to put it there ? and should i put it in every panel ?
Are you trying to have multiple db's per tenant?
yes each tenant will have his own database
and it is working in the subdomains level (tenants) , the remaining problem now is with the main site (the place i will be using for making domains)
so you will have an admin panel where you can see all the tenants with their own database
and you will have a tenant/app panel for each tenant
yup i want to do that exactly
did you already made a panel with artisan make:filament-panel ?
yup i have admin panel yes
can you show me the content of it
sure thing
could you try without all the plugins?
and what is the redirectfilament middleware doing
its for the redirection if you are not authorized to visit a specfic route (return to login page)
still the same , the thing is that the app doesn't see the / of the main site anymore
did you try to clear cache already
yup , and nothing happened
even on another browser
there is the subdomain
and there is the localhost:8000
But I mean the cache of laravel itself
yes php artisan optimize:clear , yeah i did it
i messaged you on discord
Solution
thanks for @Geoff. and his efforts we managed to make a gist with a full guide to implement multi-tenancy with multiple database approach
here is the link for the gist
https://gist.github.com/Hegabovic/81d63f16dcceac16ecbdd0c3722857ae
now we can close this question as resolved ✅
Gist
Full Guide for Multi-tenancy with tenancy with laravel package
Full Guide for Multi-tenancy with tenancy with laravel package - multi-tenancy.md
Great job guys. This could be a great article on the Filament site. I encourage you to submit it. https://github.com/filamentphp/filamentphp.com#submitting-an-article-to-the-community-section
GitHub
GitHub - filamentphp/filamentphp.com: Source code for the filamentp...
Source code for the filamentphp.com website. Contribute to filamentphp/filamentphp.com development by creating an account on GitHub.
if i can share it there , i will do it now 😄
Please do. It’s just a PR you submit to the repo.
Make sure to give Geoff credit though. I don’t think there’s currently a way to have more than one author on an article.
i'm sure he will do that thanks for mentioning 🙂
I’m sure he will too. Just wanted to call it out.
sure thing to do 😄 😄 dont worry 😄
i have a simple question , i created the author file and the avatar , where to put the article 😄 😅
content/articles
There’s a section in that link that goes over it.
You’ll need to convert your gist to markdown, but should be fairly straight forward.
Might already be in markdown. Just looking at it on GitHub.
yeah i made it in .md formate 😄
done 😄 i'm really excited 😄
I’m excited about our community. You went from being upset about getting help to submitting an article about your experience and helping others who may have similar problems. I LOVE IT.
In the span of a few days. It’s really freaking awesome.
thanks a lot for providing me this opportiunty ❤️ ❤️
Any time.
Good things in, good things out.
here is the PR 😄 hope to see it soon on filament 😄
https://github.com/filamentphp/filamentphp.com/pull/219
GitHub
filament integration with Tenancywithlaravel Full Guide Article by...
a step by step guide which will take your application from single user to multi-tenant application
Hello, may I join?
I have followed that guide.
but still can't make it right 🥲 , the tenant database already detected, but when I try to login in admin panel, it's try to connect to central database.
should
users
table add to central database?i did it multiaple times on new project and pre-existing project and it always work 😄 , and no you dont need a users table in the central domain
please re-check steps if not working we can check it together 😄
thank you for confirm, i'll try new setup
Be sure to have two different panels
one for admin and one for tenant
and also don't forget to add set this code in the boot function of the AppServiceProvider
To make the login work
and other stuff
but you also have to check if you are in a tenant or in the admin
thank you so much @Geoff. , I'm not realize Livewire had different approach, because on documentation have different config.
also something i found here in the discord hehe
The PR is not accepted yet 😂