Tab
The Tab
class is used to create tabs in a resource or user.
Available methods:
Method | Description |
---|---|
id(string $id) | Sets the tab identifier (optional). |
position(int $position) | Sets the tab position |
description(string $description) | Sets the tab description. |
fields(array $fields) | Defines the list of fields within the tab. |
permissions(array $permissions) | Controls where the element is shown based on conditions. |
Permissions
Rule | Description |
---|---|
resource | Comma-separated list of resource IDs. Tab is shown only on these resources. |
parent | Parent resource ID(s). Tab is shown only for children of these parents. |
template | Template ID(s). Tab is shown only on resources with these templates. |
user | User ID(s). Tab is shown only for these users. |
user_group | User group ID(s). Tab is shown only to users in these groups. |
Example usage:
php
Tab::make('Custom tab')
->id('extra')
->position(2)
->fields([
Field::make('notes')->type('textarea')->label('Notes'),
Field::make('status')->type('select')->values([
'active' => 'Active',
'inactive' => 'Inactive'
]),
]);
This example creates a "Custom tab" with
id = extra
, which will be the second tab in order and contain two fields.
php
Tab::make('SEO')->fields([
Field::make('meta_title')->label('Meta Title'),
Field::make('meta_description')->type('textarea')->label('Meta Description')
]);