Route Subdomain / Domain
nmfirdausw opened this issue · comments
Hi,
Is there way to configure folio for different subdomain grouping like normal route ?
->domain()
I was just coming to suggest this idea.
After watching the launch on YouTube and seeing that folio could be used along side normal routing, I was wondering if the folio routing could be restricted to a domain or subdomain just like the OP is asking.
eg. I have my SuperGreatSaaS at SGSS.com which is a normal Laravel 10 app and I want docs.SGSS.com to be routed by folio.
Is there a setting that I could use to map the subdomain to folio and the rest of the site to the normal routing?
I think this is what @nmfirdausw is asking. (It is certainly what I am asking)
@njames
Right now I'm just used it like this,
last if is for generating folio with artisan command and view folio:list
if (str_starts_with(url(''), 'http://admin.')) {
Folio::route(resource_path('views/pages/admin'), middleware: [
'*' => [
'subdomain.admin',
],
]);
}
if (str_starts_with(url(''), 'http://partner.')) {
Folio::route(resource_path('views/pages/partner'), middleware: [
'*' => [
'subdomain.partner',
],
]);
}
if (config('app.env') === 'local' && url('') === config('app.url')) {
Folio::route(resource_path('views/pages'), middleware: [
'*' => [
//
],
]);
}
Awesome!! Thanks @nunomaduro
I did test #62 feat/domains branch, It seems not working like I expected,
Or maybe I'm not use that properly, hope you can guide through,
My Issue is,
I add this two line in FolioServiceProvider,
public function boot(): void
{
Folio::path(resource_path('views/pages/admin'))->domain('admin.mydomain.test');
Folio::path(resource_path('views/pages/partner'))->domain('partner.mydomain.test');
}
When I access to admin.mydomain.test/login, It return 404,
But for partner.mydomain.test/login, It Success
It seems only second config is registered.
That's a different issue - that already existed on Folio@beta2. Can you create a new issue please?
@nmfirdausw This will address your issue: #67.
Thanks @nunomaduro Now Folio is perfect for me.