src/Metable.php
protected function metaJoinQuery(Builder $query, $method, ArgumentBag $args)
    {
        $alias = $this->joinMeta($query, $args->get('column'));

        // For aggregates we need the actual function name
        // so it can be called directly on the builder.
        $method = $args->get('function') ?: $method;

        return (in_array($method, ['orderBy', 'lists', 'pluck']))
            ? $this->{"{$method}Meta"}($query, $args, $alias)
            : $this->metaSingleResult($query, $method, $alias);
    }
protected function metaJoinQuery(Builder $query, $method, ArgumentBag $args)
    {
        $alias = $this->joinMeta($query, $args->get('column'));

        // For aggregates we need the actual function name
        // so it can be called directly on the builder.
        $method = $args->get('function') ?: $method;

        return (in_array($method, ['orderBy', 'lists', 'pluck']))
            ? $this->{"{$method}Meta"}($query, $args, $alias)
            : $this->metaSingleResult($query, $method, $alias);
    }
Join meta attributes table in order to call provided method.

@param  \Sofa\Eloquence\Builder $query
@param  string $method
@param  \Sofa\Hookable\Contracts\ArgumentBag $args
@return mixed