Skip to content

Panel

The Panel class is used to create panels in a resource or user.

Available methods:

MethodDescription
id(string $id)Sets the panel identifier (optional).
position(int $position)Sets the panel position
description(string $description)Sets the panel description.
fields(array $fields)Defines the list of fields within the panel.
hideTitle(bool $hideTitle = true)Hides the header
collapsible(bool $collapsible = true)Allows the panel to be collapsible
collapsed(bool $collapsed = true)Sets if the panel is collapsed by default.
Permissions
RuleDescription
resourceComma-separated list of resource IDs. Panel is shown only on these resources.
parentParent resource ID(s). Panel is shown only for children of these parents.
templateTemplate ID(s). Panel is shown only on resources with these templates.
userUser ID(s). Panel is shown only for these users.
user_groupUser group ID(s). Panel is shown only to users in these groups.

Example usage:

php
Panel::make('Products')
    ->position(0)
    ->description('Products description')
    ->fields([
        Field::make('Products')
            ->type('table')
            ->resource()
            ->fields([
                Field::make('Price')
                    ->type('number')
                    ->minValue(0)
                    ->width(50)
                    ->required(),

                Field::make('Old price')
                    ->type('number')
                    ->minValue(0)
                    ->width(50)
                    ->required(),
            ])
            ->columns([
                Column::make('Price'),
                Column::make('Old price'),
            ])
    ]);

This example creates a "Custom tab" with id = extra, which will be the second tab in order and contain two fields.

php
Panel::make('SEO')->fields([
    Field::make('meta_title')->label('Meta Title'),
    Field::make('meta_description')->type('textarea')->label('Meta Description')
]);

© PageBlocks 2019-present