protected function hasRequiredAbility($user, $ability = null, $model = null)
    {
        if (!$user) {
            return false;
        }

        if (is_null($ability)) {
            return true;
        }

        /*
         * Some gates may check on number of arguments given. If model
         * is null, don't pass it as an argument.
         */
        if (is_null($model)) {
            return $user->can($ability);
        }

        return $user->can($ability, $model);
    }
protected function hasRequiredAbility($user, $ability = null, $model = null)
    {
        if (!$user) {
            return false;
        }

        if (is_null($ability)) {
            return true;
        }

        /*
         * Some gates may check on number of arguments given. If model
         * is null, don't pass it as an argument.
         */
        if (is_null($model)) {
            return $user->can($ability);
        }

        return $user->can($ability, $model);
    }
protected function hasRequiredAbility ( $ user , $ ability = null , $ model = null ) { if ( ! $ user ) { return false ; } if ( is_null ( $ ability ) ) { return true ; } /*
         * Some gates may check on number of arguments given. If model
         * is null, don't pass it as an argument.
         */ if ( is_null ( $ model ) ) { return $ user -> can ( $ ability ) ; } return $ user -> can ( $ ability , $ model ) ; }
Determine if the currently logged in use has the given ability.

@param $user
@param string|null                              $ability
@param \Illuminate\Database\Eloquent\Model|null $model

@return bool
Determine if the currently logged in use has the given ability .