Skip to content

Fix: Custom panel domains does not work.#41

Merged
bezhanSalleh merged 3 commits intobezhanSalleh:3.xfrom
pelmered:3.x
May 12, 2025
Merged

Fix: Custom panel domains does not work.#41
bezhanSalleh merged 3 commits intobezhanSalleh:3.xfrom
pelmered:3.x

Conversation

@pelmered
Copy link
Copy Markdown
Contributor

@pelmered pelmered commented May 1, 2025

The current implementation does not work if you use custom domains for you different panels. It only uses the path you specify in your panel provider.

For example:

// Panel 1
class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            //...
            ->path('')
            ->domains(['app.'.config('app.domain')]);
    }
}

// Panel 2
class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->default()
            //...
            ->path('')
            ->domains(['admin.'.config('app.domain')]);
    }
}

It might seem unnecessary to include a package for this, but this package is already included in Laravel 11.35+ so it should only be an extra dependency for projects that uses older versions of Laravel. This was better than to use the URL helper that shipps with Laravel 11.35+ as you would than have to require Laravel 11.35+.

@what-the-diff
Copy link
Copy Markdown

what-the-diff Bot commented May 1, 2025

PR Summary

  • Integration of a new coding resource: To offer us more possibilities, we have inserted the league/uri toolbox into our ongoing project. This particular version (^7.5) was chosen for its proven efficiency.
  • Enhancement of PanelSwitch class: We've brought in Arr from the Illuminate\Support package and Uri from the League\Uri package to src/PanelSwitch.php - our class that interfaces between different panels for smoother navigation.
  • Refining how we get panels: We've tweaked the way we generate URLs for panels to be slicker and more efficient. Conveniently, we now have a getPanelUrl() function to handle this instead of directly using url($panel->getPath()).
  • Introduction of getPanelUrl(): This new function is a significant advancement. It smartly builds a URL using the Uri tool along with the panel's path and the initial domain from its related domains.

@bezhanSalleh bezhanSalleh merged commit 22bfd56 into bezhanSalleh:3.x May 12, 2025
1 of 9 checks passed
@bezhanSalleh
Copy link
Copy Markdown
Owner

Thanks!

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