PHP code example of netcore / module-admin

1. Go to this page and download the library: Download netcore/module-admin 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/ */

    

netcore / module-admin example snippets


menu('leftAdminMenu')->getItemTree();

menu()->get();

menu('<MENU KEY>')->render('<TEMPLATE NAME>');

menu('<MENU KEY>')->render('<TEMPLATE NAME>', '<PATH>');

menu('leftAdminMenu')->render('menu', 'client.partials');


$menus = [
    [
        name => 'leftAdminMenu',
        type => 'admin',
        items => [
                'name'   => 'Dashboard',
                'icon'   => 'ion-ios-pulse-strong',
                'type'   => 'route',
                'value'  => 'admin::dashboard.index',
                'module' => 'Admin',
                'is_active' => 1,
                'parameters' => json_encode([])
            ],
            [
                'name'   => 'Menus',
                'icon'   => 'ion-navicon-round',
                'type'   => 'route',
                'value'  => 'admin::menu.index',
                'module' => 'Admin',
                'is_active' => 1,
                'active_resolver' => 'admin::menu.*',
                'parameters' => json_encode([])
            ]
    ],
    [
        name => 'mainClientMenu',
        type => 'public',
        items => [
             [
                 'name'   => 'Homepage',
                 'icon'   => 'fa-globe',
                 'type'   => 'url',
                 'value'  => '/',
                 'parameters' => json_encode([])
             ],
         ]
    ]
];

foreach( $menus as $key => $menu ) {
    $menu = Menu::firstOrCreate([
        'name' => $menu['name'],
        'type' => $menu['type']
    ]);

    foreach( $menu['items'] as $item ){
        $menu->items()->firstOrCreate($item);
    }
}

$xslt
 php artisan module:publish Admin
 php artisan module:publish-migration Admin
 php artisan migrate
 php artisan module:seed Admin