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

Route Subdomain / Domain #56

Closed
nmfirdausw opened this issue Jul 28, 2023 · 7 comments · Fixed by #62
Closed

Route Subdomain / Domain #56

nmfirdausw opened this issue Jul 28, 2023 · 7 comments · Fixed by #62
Assignees

Comments

@nmfirdausw
Copy link

Hi,

Is there way to configure folio for different subdomain grouping like normal route ?

->domain()

@njames
Copy link

njames commented Jul 31, 2023

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)

@nmfirdausw
Copy link
Author

@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: [
                '*' => [
                    //
                ],
            ]);
        }

@nmfirdausw
Copy link
Author

Awesome!! Thanks @nunomaduro

@nmfirdausw nmfirdausw reopened this Aug 1, 2023
@nmfirdausw
Copy link
Author

@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.

@nunomaduro
Copy link
Member

That's a different issue - that already existed on Folio@beta2. Can you create a new issue please?

@nunomaduro
Copy link
Member

@nmfirdausw This will address your issue: #67.

@nmfirdausw
Copy link
Author

Thanks @nunomaduro Now Folio is perfect for me.

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

Successfully merging a pull request may close this issue.

5 participants