SpartnerNL / Laravel-Sidebar

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

Cant inject dependency for Auth #22

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi, am using this package with https://github.com/nWidart/laravel-modules . I want to use the default laravel 5.2* authentication yet i cannot get the user object which is always null when using dependency injection or even Request::user() or Auth::user() See here: ` class SidebarExtender implements \Maatwebsite\Sidebar\SidebarExtender { public function __construct(Auth $auth){ $this->auth=$auth; dd($this->auth);// null } public function extendWith(Menu $menu) { $menu->group('Dashboard', function (Group $group) { $group->item('Inventory', function (Item $item) { $item->weight(11); $item->icon('fa fa-barcode'); $item->item('Sent', function (Item $item) { $item->icon('fa fa-share-square-o'); $item->route('messaging.sent'); }); $item->item('Contacts', function (Item $item) { $item->icon('fa fa-volume-control-phone'); $item->route('messaging.contacts'); }); $item->item('Buy Airtime', function (Item $item) { $item->icon('fa fa-money'); $item->route('messaging.topup'); }); }); }); return $menu; }

}`

ghost commented 8 years ago

Found i had to use web middleware, maybe to start session

giwrgos88 commented 7 years ago

@samueldervis how you solved the issue?

pingwiniasty commented 7 years ago

Hi, I resolved this problem on 5.3 The ResolveSidebars middleware \Maatwebsite\Sidebar\Middleware\ResolveSidebars::class, must be in array $middlewareGroups['web'] in \App\Http\Kernel.php