code: function(relations, type) {
      const Utils = this.definition.store.utils
      const self = this.chain()._unresolve()
  
      var args = Utils.args(arguments)
      const existingJoins = self.getInternal('joins') || []
      const existingMap = {}
  
      existingJoins.forEach(function(inc) {
        existingMap[inc.relation] = inc
      })
  
      if (
        type &&
        ['left', 'inner', 'outer', 'right'].indexOf(type.toLowerCase()) !== -1
      ) {
        args = relations
      } else {
        type = 'inner' // default join!
      }
  
      const joins = Utils.toJoinsList(args)
  
      joins.forEach(function(join) {
        join.type = join.type || type
  
        const relation = self.definition.relations[join.relation]
  
        if (relation) {
          if (existingMap[join.relation]) return // ignore duplicated joins
          if (relation.type === 'belongs_to_polymorphic')
            throw new Error("Can't join polymorphic relations")
          if (relation.through) join.through = true
  
          self.addInternal('joins', join)
          return
        }
  
        if (join.type === 'raw') {
          self.addInternal('joins', join)
          return
        }
  
        throw new Error(
          'Can\'t find relation "' +
            join.relation +
            '" for ' +
            self.definition.modelName
        )
      })
  
      return self
    }
docs: Joins one or multiple relations with the current model
  @class Model
  @method join
  @param {string} relation - The relation name which should be joined.
  @param {string} type - Optional join type (Allowed are `left`, `inner`, `outer` and `right`).
  @or
  @param {array} relations - Array of relation names
  @or
  @param {object} relations - For nested relational joins use objects
  
  @see Model.exec
  
  @return {Model}