Skip to content

Updating new sidebar extender

Nicolas Widart edited this page Jun 22, 2015 · 7 revisions

In platform 1.0.3, a big change was implemented, the way the sidebars are handled. Laravel-sidebar has been tagged 2.0, the version introducing these new improvements.

Please read the Upgrade Guide carefully.

No SidebarViewComposer

There is no more need for a SidebarViewComposer, instead create a Sidebar/SidebarExtender.php file, copy over the contents of your old SidebarViewComposer@compose to extendWith method on the SidebarExtender class.

Change the following type hints:

  • SidebarGroup => Maatwebsite\Sidebar\Group
  • SidebarItem => Maatwebsite\Sidebar\Item

New global middleware

In app/Http/Kernel.php add the following middleware 'Maatwebsite\Sidebar\Middleware\ResolveSidebars', after ShareErrorsFromSession, in the protected $middleware property.

New published views

Delete the published views for the Sidebar package, located at resources/views/vendor/sidebar. Then publish the views again, php artisan vendor:publish.

Next, open resources/views/vendor/sidebar/group.php, and rename the css class menu-title to header.

Removed BaseSidebarViewComposer

If you were extending this composer, you have to remove the extends and inject the Authentication contract on your view composer.