public function testLists()
 {
     $list = $this->collection->lists(['first_name', 'last_name']);
     $this->assertEquals([['first_name' => 'john', 'last_name' => 'smith'], ['first_name' => 'kara', 'last_name' => 'trace'], ['first_name' => 'phil', 'last_name' => 'mcKay'], ['first_name' => 'rose', 'last_name' => 'smith']], $list);
 }
Example #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)
 {
     $select = is_null($key) ? [$column] : [$column, $key];
     if (!is_null($this->cacheMinutes)) {
         $results = $this->getCached($select);
     } else {
         $results = $this->getFresh($select);
     }
     $collection = new Collection($results);
     return $collection->lists($column, $key);
 }
Example #3
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)
 {
     $select = is_null($key) ? [$column] : [$column, $key];
     $results = new Collection($this->get($select));
     return $results->lists($column, $key);
 }