SpartnerNL / Laravel-Sidebar

A Laravel Sidebar builder
MIT License
111 stars 58 forks source link

Using the package with Laravel 5.4 and Sentinel #32

Closed Krasimir-Todorov closed 6 years ago

Krasimir-Todorov commented 7 years ago

Hello, I've managed to load the sidebar, extend it and render it, all looks pretty awesome. I experienced some difficulty with using Sentinel inside SidebarExtenders to display some of the menus based on the permissions of the user. Unfortunately, when I try to access Sentinel it's always a empty object. I found that from Laravel 5.3 there is а change how classes are loaded and you can not access Auth (maybe Sentinel also) within construct methods and while Laravel boots because actually there is still no real request. That's a problem because we load the sidebar using dependency injection inside the construct method of our AdminController. So my questions are: 1) Does this package supports using of Sentinel inside it for Laravel 5.4? 2) Or can we somehow load the sidebar inside a middleware maybe? (Where Sentinel is available and works)

Thanks in advance.

nWidart commented 7 years ago

Hi,

I'm also using sentinel inside the extenders, and they're working as expecting. They're able to get the current user etc.

patrickbrouwers commented 7 years ago

Try resolving it through a view creator like in the docs.