Skip to content

Panel

A panel is a module that encapsulates a section of your whole app, e.g admin section of your app, blog section etc. Panel are consists of page, controller and layout. Panel have a dashboard page by default.

Creating Panel

Run following command to create new panel.

Terminal window
php artisan xumina:panel

It will prompt you for panel name

panel command option

Newly created panel will be available at app/Xumina/ directory.

  • Directoryapp
    • DirectoryProviders
      • DirectoryXumina
        • PanelServiceProvider.php
    • DirectoryXumina
      • DirectoryPanelName
        • DirectoryControllers
          • DashboardController.php
        • DirectoryPages
          • Dashboard.php

Panel route prefix

To change route prefix path for a panel, call prefix method on the panel class inside panel provider register method

public function register(): void
{
$this->panel = app('xumina')->registerPanel('App');
$this->panel->prefix('/');
}

Authorization

You can control access to an entire panel based on custom logic via the panel authorize method.

public function boot(): void
{
$this->panel
->authorize(fn($user) => $user->isAdmin())
}

Root Page

By default a dashboard page is created when you create a panel and it’s the root page of that panel. When you visit a panel you’ll land on the dashboard page. You can customize which page should be treated as root by using rootPage method

public function boot(): void
{
$this->panel
->layout(DefaultLayout::class)
->rootPage(\My\Custom\Page::class);
}

Layout

By default the DefaultLayout is used for panel layout, but you can use a custom layout via layout method. More on Layout Docs

Theme

By default the DefaultTheme is used, to use a different theme use theme method. More on Theme Docs