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

Feat: Custom Panels URLs (ex: subdomains or any url) #13

Closed
wants to merge 3 commits into from
Closed

Feat: Custom Panels URLs (ex: subdomains or any url) #13

wants to merge 3 commits into from

Conversation

Saifallak
Copy link

@Saifallak Saifallak commented Oct 23, 2023

i need to hide current panel so thats 30c9e00

also need to override the url ( 1a14c32 ), because in #7 (comment) it breaked my app, because i have each panel on diff, sub domain, so this must not be relative at all.

@Saifallak
Copy link
Author

i need to hide current panel so thats 30c9e00

@Saifallak
Copy link
Author

Saifallak commented Oct 23, 2023

also need to override the url ( 1a14c32 ), because in #7 (comment) it breaked my app, because i have each panel on diff, sub domain, so this must not be relative at all.

@Saifallak
Copy link
Author

Could you check this? @bezhanSalleh

@bezhanSalleh
Copy link
Owner

Could you check this? @bezhanSalleh

You can exclude the current panel already via excludes() method. So, no need for a new method.

So for the paths, what are you doing when you say you have the panels on different subdomains?

I need a little bit of context here to see that there might be a better way. been busy with vue for past couple of months so not really up-to date with the new filament features.

@Saifallak
Copy link
Author

Saifallak commented Nov 17, 2023

for excluding current panel, didn't think that excludes access closure, okay ill revert this change.


i have panels like the following:

admin.example.com
client.example.com
dev.example.com

i need to switch between them.

@Saifallak Saifallak changed the title Feat exclude current panel & custom url Feat: Custom Panels URLs (ex: subdomains or any url) Nov 17, 2023
@Saifallak
Copy link
Author

been busy with vue for past couple of months so not really up-to date with the new filament features.

no hurry, take your time.

@bezhanSalleh
Copy link
Owner

bezhanSalleh commented Nov 17, 2023

for excluding current panel, didn't think that excludes access closure, okay ill revert this change.

i have panels like the following:

admin.example.com client.example.com dev.example.com

i need to switch between them.

ok, i think i have the time to make a release. So, show me the panel configurations. or you can just take the demo app for instance.
the main domain is say filament-demo.test so the app domain would be app.filament-demo.test if so how would you configure your panels for them?

or if this doesn't make sense give me an example using the urls() method you implemented for the above scenario. how would you use it?

@Saifallak
Copy link
Author

Panel 1:

public function panel(Panel $panel): Panel
    {
        return $panel
            ->id('admin')
            ->path('')
            ->domain('cp.' . parse_url(config('app.url'))['host'])
            ->authGuard('admins')
            ->colors([
                'primary' => Color::Blue,
            ]);

Panel 2:

public function panel(Panel $panel): Panel
    {
        return $panel
            ->id('dev')
            ->path('')
            ->domain('dev.' . parse_url(config('app.url'))['host'])
            ->authGuard('admins')
            ->colors([
                'primary' => Color::Red,
            ]);

Panel 3:

public function panel(Panel $panel): Panel
    {
        return $panel
            ->id('console')
            ->path('')
            ->domain('console.' . parse_url(config('app.url'))['host'])
            ->authGuard('admins')
            ->colors([
                'primary' => Color::Green,
            ]);

I just wanted to use URLs like the following:
because it doesn't work out of the box

PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
            $panelSwitch
                ->urls([
                    'admin' => 'https://' . 'cp.' . parse_url(config('app.url'))['host'],
                    'dev' => 'https://' . 'dev.' . parse_url(config('app.url'))['host'],
                    'console' => 'https://' . 'console.' . parse_url(config('app.url'))['host'],
                ]);
        });

@bezhanSalleh
Copy link
Owner

this should be handled by the plugin automatically. which now it does 😎.
update to the latest release and let me know if you face any issues

@Saifallak
Copy link
Author

@bezhanSalleh okay it works, thanks ♥

btw, is there a way to show this switch on auth screens too ?

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

Successfully merging this pull request may close these issues.

2 participants