lavary/laravel-menu

Filter on Menu not working

Opened this issue · 1 comments

Hi,
I want to show menus based on User permissions and Roles in my application, I use Filter function there as per the documentation suggesting

->filter(function($item){
if(User::get()->can( $item->data('permission'))) {
return true;
}
return false;
});

$navbars->get('amazon_repricer')->add('Items', 'items', ['action' => 'AmazonRepricerItems@index'])->prepend('')->filter(function($item){
if(User::get()->can( $item->data('permission'))) {
return true;
}
return false;
});

But its not working for me and giving error "Call to undefined method Lavary\Menu\Item::filter()"

Please suggest a solution how it will work for me?

Thanks

Anybody there? Who can help me to sort out this issue?