Skip to content

Menu

Creates a menu item in the main navigation.

Available methods:

MethodDescription
title(string $title)Sets the menu title.
description(string $description)Sets the menu description.
icon(string $icon)Sets an icon for the menu.
position(int $position)Sets the menu position.
parent(string $parent)Sets the menu category. Default is topnav.
tabs(array $tabs)Adds tabs to the menu page.
permissions(string $permissions)Controls where the element is shown based on conditions.
Permissions
RuleDescription
userUser ID(s). Menu is shown only for these users.
user_groupUser group ID(s). Menu is shown only to users in these groups.
php
Menu::make('reviews')
    ->title('Reviews')
    ->description('Review list')
    ->icon('fa-star')
    ->position(1)
    ->parent('pageblocks')
    ->fields([
        Field::make('reviews')
            ->label('Reviews')
            ->type('table')
            ->fields([
                Field::make('Name')
                    ->width(70)
                    ->required(),

                Field::make('Date')
                    ->type('date')
                    ->width(30)
                    ->storage('timestamp')
                    ->dateFormat('Y-m-d, H:i')
                    ->required()
                    ->default(time()),

                Field::make('message')
                    ->label('Review')
                    ->type('textarea')
                    ->height(100)
                    ->required(),
            ])

            ->columns([
                Column::make('name')
                    ->label('Name')
                    ->width(150),
                    
                Column::make('Message'),
                
                Column::make('Date')
                    ->width(150)
                    ->render('date'),
            ])
            ->searchable()
    ]),

© PageBlocks 2019-present