src/Database/Queries/AbilitiesForModel.php
protected function abilitySubqueryConstraint(Model $model, $strict)
    {
        return function ($query) use ($model, $strict) {
            // If the model does not exist, we want to search for blanket abilities
            // that cover all instances of this model. If it does exist, we only
            // want to find blanket abilities if we're not using strict mode.
            if ( ! $model->exists || ! $strict) {
                $query->whereNull("{$this->table}.entity_id");
            }

            if ($model->exists) {
                $query->orWhere("{$this->table}.entity_id", $model->getKey());
            }
        };
    }
protected function abilitySubqueryConstraint(Model $model, $strict)
    {
        return function ($query) use ($model, $strict) {
            // If the model does not exist, we want to search for blanket abilities
            // that cover all instances of this model. If it does exist, we only
            // want to find blanket abilities if we're not using strict mode.
            if ( ! $model->exists || ! $strict) {
                $query->whereNull("{$this->table}.entity_id");
            }

            if ($model->exists) {
                $query->orWhere("{$this->table}.entity_id", $model->getKey());
            }
        };
    }
protected function abilitySubqueryConstraint ( Model $ model , $ strict ) { return function ( $ query ) use ( $ model , $ strict ) { // If the model does not exist, we want to search for blanket abilities // that cover all instances of this model. If it does exist, we only // want to find blanket abilities if we're not using strict mode. if ( ! $ model -> exists || ! $ strict ) { $ query -> whereNull ( "{$this->table}.entity_id" ) ; } if ( $ model -> exists ) { $ query -> orWhere ( "{$this->table}.entity_id" , $ model -> getKey ( ) ) ; } } ; }
Get the constraint for the ability subquery.

@param  \Illuminate\Database\Eloquent\Model  $model
@param  bool  $strict
@return \Closure
Get the constraint for the ability subquery .