PHP code example of alt-design / alt-admin-bar

1. Go to this page and download the library: Download alt-design/alt-admin-bar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alt-design / alt-admin-bar example snippets


use AltDesign\AltAdminBar\DTO\MenuItemDTO;

Illuminate\Support\Facades\Event::listen('alt_admin_menu_items', function ($menuItems) {
    
    // Standard link w/ url
    $menuItems[] = MenuItemDTO::make([
        'title' => 'Simple Title',
        'href' => '/simple-link',
    ]);
    
    // Item with Children
    $menuItems[] = MenuItemDTO::make([
        'title' => 'Simple Title With Children',
        'href' => '/simple-title-with-children',
        'children' => [
            MenuItemDTO::make([
                'title' => 'Simple Child',
                'href' => '/simple-child',
            ]),
            MenuItemDTO::make([
                'title' => 'Simple Child ',
                'href' => '/simple-child-2',
            ])
        ]
    ]);
    
    // Control Panel Route (Using Runway as an example)
    $menuItems[] = MenuItemDTO::make([
        'title' => 'Edit Specific Page In Control Panel',
        'href' => 'runway.edit', // Route Name
        'cp_route' => true, // Tells the addon to use the cp_route() helper
        'route_args' => ['resource' => 'example', 'model' => $id]
    ]);
    
    return $menuItems;
    
});