ArtisanPack UI
DocsEcommerce Admin LivewireExtending Overview

Extending Overview

Ecommerce Admin Livewire v2.0.0

Other packages (satellites) and host applications extend the admin through registries and filters. Nothing here requires publishing views. - Navigation -...

Other packages (satellites) and host applications extend the admin through registries and filters. Nothing here requires publishing views.

In this section

Two kinds of extension point

Registries are singletons under ArtisanPackUI\EcommerceAdminLivewire\Registries\. Resolve one from the container and register in your service provider's boot():

use ArtisanPackUI\EcommerceAdminLivewire\Registries\OrderPanelRegistry;

public function boot(): void
{
    app( OrderPanelRegistry::class )->register( 'loyalty', 'loyalty-order-panel', 'side', 30 );
}
Registry Adds
OrderPanelRegistry Order detail panels
ProductTypePanelRegistry Product form type tabs
CustomerTabRegistry Customer detail tabs
SettingsTabRegistry Settings tabs with their own component
ConfigFormRegistry Field schemas for engine registry config blobs
PickerSourceRegistry Picker search sources

Filters use artisanpack-ui/hooks. Register them with addFilter(), usually in boot():

addFilter( 'ap.ecommerceAdminLivewire.dashboard.widgets', function ( array $widgets ): array {
    $widgets[] = [ /* … */ ];

    return $widgets;
} );

Rules every extension follows

  • Register your own Livewire components. Panels and tabs are Livewire components you register with Livewire::component() in your package.
  • Authorize inside your component. The admin only guarantees the user can view the page's record. Check the abilities your panel needs in mount() and in every action. Use ArtisanPackUI\EcommerceAdminLivewire\Support\Authorization::allows( $user, 'order.update', $order ) or the engine's policies.
  • Abilities are {resource}.{action}. An ecommerce. prefix is accepted where an entry declares a permission. A malformed permission drops the entry and logs a warning; it never breaks the admin.
  • Translate labels per request. Registries that take a label accept a closure (fn (): string => __( 'Points' )) so it is translated in the request's locale.
  • A later registration with the same key replaces an earlier one. Use that to replace a built-in panel or tab. unregister() (or forget() for product types) removes one.

Stay in the Loop

Monthly tips, tutorials and package updates — plus a free Quick Start cheat sheet.

Subscribe
Edit this page on GitHub