src/Models/MenuItem.php
public function ifCan(string $ability, $params = null, $guard = null)
    {
        $this->hideCallbacks->push(function () use ($ability, $params, $guard) {
            return ! optional(auth()->guard($guard)->user())->can($ability, $params);
        });

        return $this;
    }
public function ifCan(string $ability, $params = null, $guard = null)
    {
        $this->hideCallbacks->push(function () use ($ability, $params, $guard) {
            return ! optional(auth()->guard($guard)->user())->can($ability, $params);
        });

        return $this;
    }
public function ifCan ( string $ ability , $ params = null , $ guard = null ) { $ this -> hideCallbacks -> push ( function ( ) use ( $ ability , $ params , $ guard ) { return ! optional ( auth ( ) -> guard ( $ guard ) -> user ( ) ) -> can ( $ ability , $ params ) ; } ) ; return $ this ; }
Set authorization callback for current menu item.

@param string $ability
@param mixed  $params
@param string $guard

@return $this
Set authorization callback for current menu item .