leecraigjeffries / laravel-sidebar
Laravel Sidebar
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/leecraigjeffries/laravel-sidebar
Requires
- php: >=7.1.3
- facade/ignition-contracts: ^1.0
- illuminate/support: ^5.6|^6.0
- illuminate/view: ^5.6|^6.0
This package is auto-updated.
Last update: 2025-12-29 02:52:27 UTC
README
1. Install Laravel Sidebar
Run this at the command line:
composer require leecraigjeffries/laravel-sidebar
This will update composer.json and install the package into the vendor/ directory.
2. Define your sidebars
Create a file called routes/sidebar.php that looks like this:
<?php /// Parameters: sidebar name, path to view Sidebar::register('default', 'vendor.sidebar.default', static function ($sidebar) { // Text, name of route or href, extra properties $sidebar->push('Section', '#section', ['icon' => '<i class="far fa-flag"></i>'], static function ($group) { $group->push('Heading', '', null, static function ($heading) { $heading->push('Link', '#link', null, static function($link){ // Links can be embedded endlessly $link->push('Sub Link', '#sublink')->setActive(); }); }); }); });
3. Render your Sidebar in Blade View
{!! Sidebar::render('default') !!}
The $link variable will be used in the chosen view
4. Active Links
Active links are links that have the same route name as that which is currently in use
By using $link->getHasActiveChild() the view will know that the link has a child embedded that is active
To see whether a link is active you can use $link->getActive()
5. Publishing the SASS and view file
By running php artisan vendor:publish you can publish example view and SASS files