src/Database/Scope/Scope.php
protected function applyToQuery($query, $table)
    {
        return $query->where(function ($query) use ($table) {
            $query->where("{$table}.scope", $this->scope)
                  ->orWhereNull("{$table}.scope");
        });
    }
protected function applyToQuery($query, $table)
    {
        return $query->where(function ($query) use ($table) {
            $query->where("{$table}.scope", $this->scope)
                  ->orWhereNull("{$table}.scope");
        });
    }
protected function applyToQuery ( $ query , $ table ) { return $ query -> where ( function ( $ query ) use ( $ table ) { $ query -> where ( "{$table}.scope" , $ this -> scope ) -> orWhereNull ( "{$table}.scope" ) ; } ) ; }
Apply the current scope to the given query.

This internal method does not check whether
the given query needs to be scoped. That
is fully the caller's responsibility.

@param  \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder  $query
@param  string  $table
@return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
Apply the current scope to the given query .