laravel-menu icon indicating copy to clipboard operation
laravel-menu copied to clipboard

Filter on Menu not working

Open mtkumar82 opened this issue 1 year ago • 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

mtkumar82 avatar Aug 03 '23 09:08 mtkumar82

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

mtkumar82 avatar Aug 04 '23 04:08 mtkumar82