Exemplo n.º 1
0
 /**
  * Get an array with the values of a given column.
  *
  * @param  string  $column
  * @param  string  $key
  * @return array
  */
 public function lists($column, $key = null)
 {
     $results = $this->query->lists($column, $key);
     if ($this->model->hasGetMutator($column)) {
         foreach ($results as $key => &$value) {
             $fill = array($column => $value);
             $value = $this->model->newFromBuilder($fill)->{$column};
         }
     }
     return $results;
 }
Exemplo n.º 2
0
 /**
  * Get an array with the values of a given column.
  *
  * @param  string  $column
  * @param  string  $key
  * @return array
  */
 public function lists($column, $key = null)
 {
     $results = $this->query->lists($column, $key);
     // If the model has a mutator for the requested column, we will spin through
     // the results and mutate the values so that the mutated version of these
     // columns are returned as you would expect from these ORM models.
     if ($this->model->hasGetMutator($column)) {
         foreach ($results as $key => &$value) {
             $fill = array($column => $value);
             $value = $this->model->newFromBuilder($fill)->{$column};
         }
     }
     return $results;
 }