PHP code example of therour / laravel-sb-admin-2

1. Go to this page and download the library: Download therour/laravel-sb-admin-2 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/ */

    

therour / laravel-sb-admin-2 example snippets


/*
* Package Service Providers...
*/
...
Therour\SbAdmin2\Providers\SbAdmin2ServiceProvider::class,
...

'sidebar-menu' => 'layouts.menu' // set to layouts/menu.blade.php

@sidebarHeading('Heading 1') // output Heading 1

@sidebarMenu([ // Create Menu
    'title' => 'Application',
    'icon' => 'fas fa-fw fa-cubes',
    'url' => '#',
    // 'active' => '/' // define your url pattern to match for giving active class
    // by default is current url == menu's url will set the menu's class active.
])

@sidebarDropdown([ // Create Dropdown menu
    'title' => 'Dropdowns',
    'icon' => 'fas fa-fw fa-cubes',
    'active' => '/dropdowns/*' // same as menu's active url pattern
    ], function ($dropdown) {
        $dropdown->heading('Heading:'); // add heading inside dropdown
        $dropdown->menu(['title' => 'Sub Menu 1', 'url' => url('dropdowns/1')]);
        $dropdown->menu(['title' => 'Sub Menu 2', 'url' => url('dropdowns/2')]);
        $dropdown->menu(['title' => 'Sub Menu 3', 'url' => url('dropdowns/3')]);
        $dropdown->menu(['title' => 'Sub Menu 4', 'url' => url('dropdowns/4')]);
    }
)

    php artisan sb-admin:scaffold
    

    php artisan vendor:publish --provider="Therour\SbAdmin2\Providers\SbAdmin2ServiceProvider"
    // if you managed to publish the compiled assets, run this
    php artisan sb-admin:publish-assets
    

// home.blade.php
@setOption('title', 'Home')

// sb-admin-2/views/layouts/partials/topbar.blade.php
<h1>{{ $sbOptions->title }}</h1>