src/Clipboard.php
protected function getHasAbilityQuery($authority, $ability, $model, $allowed)
    {
        $query = Abilities::forAuthority($authority, $allowed);

        if (! $this->isOwnedBy($authority, $model)) {
            $query->where('only_owned', false);
        }

        if (is_null($model)) {
            return $this->constrainToSimpleAbility($query, $ability);
        }

        return $query->byName($ability)->forModel($model);
    }
protected function getHasAbilityQuery($authority, $ability, $model, $allowed)
    {
        $query = Abilities::forAuthority($authority, $allowed);

        if (! $this->isOwnedBy($authority, $model)) {
            $query->where('only_owned', false);
        }

        if (is_null($model)) {
            return $this->constrainToSimpleAbility($query, $ability);
        }

        return $query->byName($ability)->forModel($model);
    }
protected function getHasAbilityQuery ( $ authority , $ ability , $ model , $ allowed ) { $ query = Abilities :: forAuthority ( $ authority , $ allowed ) ; if ( ! $ this -> isOwnedBy ( $ authority , $ model ) ) { $ query -> where ( 'only_owned' , false ) ; } if ( is_null ( $ model ) ) { return $ this -> constrainToSimpleAbility ( $ query , $ ability ) ; } return $ query -> byName ( $ ability ) -> forModel ( $ model ) ; }
Get the query for where the given authority has the given ability.

@param  \Illuminate\Database\Eloquent\Model  $authority
@param  string $ability
@param  \Illuminate\Database\Eloquent\Model|string|null  $model
@param  bool  $allowed
@return \Illuminate\Database\Eloquent\Builder
Get the query for where the given authority has the given ability .