Example #1
0
 /**
  * Extends of the lists function.
  * Allowing use table name or a subquery for each column and key parameter
  * @param  string $column
  * @param  string $key
  * @return array
  */
 public function lists($column, $key = null)
 {
     $select = is_null($key) ? array($column) : array($column, $key);
     $columns = $this->getListSelect($column, $key);
     $results = new \Illuminate\Support\Collection($this->get($select));
     $values = $results->fetch($columns[0])->all();
     if (!is_null($key) && count($results) > 0) {
         $keys = $results->fetch($columns[1])->all();
         return array_combine($keys, $values);
     }
     return $values;
 }