/**
  * Get the hydrated models without eager loading.
  *
  * @param  array  $columns
  * @return \Database\ORM\Model[]
  */
 public function getModels($columns = array('*'))
 {
     $results = $this->query->get($columns);
     $connection = $this->model->getConnectionName();
     $models = array();
     foreach ($results as $result) {
         $models[] = $model = $this->model->newFromBuilder($result);
         $model->setConnection($connection);
     }
     return $models;
 }
 /**
  * Create a new pivot model instance.
  *
  * @param  \Database\ORM\Model  $parent
  * @param  array   $attributes
  * @param  string  $table
  * @param  bool    $exists
  * @return void
  */
 public function __construct(Model $parent, $attributes, $table, $exists = false)
 {
     parent::__construct();
     //
     $this->setRawAttributes($attributes, true);
     $this->setTable($table);
     $this->setConnection($parent->getConnectionName());
     //
     $this->parent = $parent;
     $this->exists = $exists;
     $this->timestamps = $this->hasTimestampAttributes();
 }