Panel
The Panel class is used to create panels in a resource or user.
Available methods:
| Method | Description |
|---|---|
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
| Rule | Description |
|---|---|
resource | Comma-separated list of resource IDs. Panel is shown only on these resources. |
parent | Parent resource ID(s). Panel is shown only for children of these parents. |
template | Template ID(s). Panel is shown only on resources with these templates. |
user | User ID(s). Panel is shown only for these users. |
user_group | User 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')
]);