Additionally/Extensions/Administrative panel module

Administrative Panel

The 'Administrative Panel' module in the HLEB2 framework is an extension to the HLOGIN registration library, but it can also be used independently as one or more administrative panels on a single site or as a public frontend for a website.

This library was used to create the look of this framework documentation site without significant modifications.


#Installation

Using Composer:

$composer require phphleb/adminpan


#Configuration

By running the following command, the adminpan.php file, describing how to build a menu structure for the administrative panel, will be copied to the /config/structure/ directory.

$php console phphleb/adminpan add

Initially, the /config/structure/adminpan.php file contains an empty array, with no menu sections defined. Menu sections are assigned by specifying special route names (or standard links). Example for a demo route:

Route::get('/{lang}/panel/page/default')
    ->
page('adminpan'ExamplePanelController::class)
    ->
name('adminpan.default');

Here, it specifies that for the menu 'adminpan' (named the same as the adminpan.php file), the URL '/{lang}/panel/page/default' is assigned the page() controller of the ExamplePanelController class, targeting the 'index' method. Additionally, the route has a name 'adminpan.default', which is needed for mapping to a section in the menu. Now the first menu item can be created in the /config/structure/adminpan.php file.

<?php

return [
    
'design' => 'base'// base|light default `base`
    
'breadcrumbs' => 'on'// on|off default 'on'
    
'section' => [
        [
            
'name' => [
                
'ru' => 'Главное меню',
                
'en' => 'Main menu'
            
],
            
'section' => [
                [
                    
'route' => 'adminpan.default',
                    
'name' => [
                        
'en' => 'Test page',
                        
'ru' => 'Тестовая страница',
                    ],
                ],
            ],
        ],
    ]
];

The menu can contain nested dropdown lists ('section'), currently there's only one assigned with a single item.

If you navigate to the URL '/ru/panel/page/default', the design will be set to 'base' (from the settings) for the page. Also, the menu will have the 'Main Menu' with the active item 'Test Page' where content from the ExamplePanelController will be displayed.

When used in conjunction with the HLOGIN library, the admin panel routes may be accessible only to a specific type of user (authenticated).

For a deeper understanding of the admin panel operation, you can deploy this site locally and explore its menu structure.

Library repository: github.com/phphleb/adminpan

Page translated: chatgpt 4-o
Back to top