src/Database/Queries/Abilities.php
protected static function getEveryoneConstraint($allowed)
    {
        return function ($query) use ($allowed) {
            $permissions = Models::table('permissions');
            $abilities   = Models::table('abilities');
            $prefix      = Models::prefix();

            $query->from($permissions)
                  ->whereRaw("{$prefix}{$permissions}.ability_id = {$prefix}{$abilities}.id")
                  ->where("{$permissions}.forbidden", ! $allowed)
                  ->whereNull('entity_id');

            Models::scope()->applyToRelationQuery($query, $permissions);
        };
    }
protected static function getEveryoneConstraint($allowed)
    {
        return function ($query) use ($allowed) {
            $permissions = Models::table('permissions');
            $abilities   = Models::table('abilities');
            $prefix      = Models::prefix();

            $query->from($permissions)
                  ->whereRaw("{$prefix}{$permissions}.ability_id = {$prefix}{$abilities}.id")
                  ->where("{$permissions}.forbidden", ! $allowed)
                  ->whereNull('entity_id');

            Models::scope()->applyToRelationQuery($query, $permissions);
        };
    }
protected static function getEveryoneConstraint ( $ allowed ) { return function ( $ query ) use ( $ allowed ) { $ permissions = Models :: table ( 'permissions' ) ; $ abilities = Models :: table ( 'abilities' ) ; $ prefix = Models :: prefix ( ) ; $ query -> from ( $ permissions ) -> whereRaw ( "{$prefix}{$permissions}.ability_id = {$prefix}{$abilities}.id" ) -> where ( "{$permissions}.forbidden" , ! $ allowed ) -> whereNull ( 'entity_id' ) ; Models :: scope ( ) -> applyToRelationQuery ( $ query , $ permissions ) ; } ; }
Get a constraint for abilities that have been granted to everyone.

@param  bool  $allowed
@return \Closure
Get a constraint for abilities that have been granted to everyone .