public function scopeWithout($query, $relations)
    {
        $relations = is_array($relations) ? $relations : array_slice(func_get_args(), 1);
        $relationships = array_dot($query->getEagerLoads());
        foreach ($relations as $relation) {
            unset($relationships[$relation]);
        }

        return $query->setEagerLoads([])->with(array_keys($relationships));
    }
public function scopeWithout($query, $relations)
    {
        $relations = is_array($relations) ? $relations : array_slice(func_get_args(), 1);
        $relationships = array_dot($query->getEagerLoads());
        foreach ($relations as $relation) {
            unset($relationships[$relation]);
        }

        return $query->setEagerLoads([])->with(array_keys($relationships));
    }
public function scopeWithout ( $ query , $ relations ) { $ relations = is_array ( $ relations ) ? $ relations : array_slice ( func_get_args ( ) , 1 ) ; $ relationships = array_dot ( $ query -> getEagerLoads ( ) ) ; foreach ( $ relations as $ relation ) { unset ( $ relationships [ $ relation ] ) ; } return $ query -> setEagerLoads ( [ ] ) -> with ( array_keys ( $ relationships ) ) ; }
Set the relationships that should not be eager loaded.

@param Illuminate\Database\Query\Builder $query
@param mixed                             $relations

@return $this
Set the relationships that should not be eager loaded .