therour / laravel-sb-admin-2
Sb Admin Layout for Laravel
Installs: 58
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Language:HTML
Requires
- php: ^7.1.13
- illuminate/console: 5.8.*|^6.0
- illuminate/http: 5.8.*|^6.0
- illuminate/support: 5.8.*|^6.0
README
original theme link
Installation
- Install the package via composer
composer require therour/laravel-sb-admin
- (Laravel 5.5 below only) add the provider to the config file
config/app.php
/* * Package Service Providers... */ ... Therour\SbAdmin2\Providers\SbAdmin2ServiceProvider::class, ...
- Install views.
a. Install by scaffold the
make:auth
-like views using (nb: this will publish the config file, and public asset files)
b. Publish the resource files, (this will publish resource files inphp artisan sb-admin:scaffold
resources/sb-admin-2
folders, and publish the config file)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
- (optional) Run the demo routes, by set
demo => true
in yourconfig/sb-admin-2.php
config file, Then you can access/demos
routes.
Special Usage
Define global variables in view
you can set variable in first view by using blade directive @setOption
// home.blade.php
@setOption('title', 'Home')
// sb-admin-2/views/layouts/partials/topbar.blade.php
<h1>{{ $sbOptions->title }}</h1>
Create Sidebarmenu
You can define your sidebar layout by add configuration in config/sb-admin-2.php
'sidebar-menu' => 'layouts.menu' // set to layouts/menu.blade.php
to create the menu itself you can use some blade directives example is in sidebar-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')]); } )