Example #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)
 {
     $columns = $this->getListSelect($column, $key);
     // First we will just get all of the column values for the record result set
     // then we can associate those values with the column if it was specified
     // otherwise we can just give these values back without a specific key.
     $results = new Collection($this->get($columns));
     $values = $results->fetch($columns[0])->all();
     // If a key was specified and we have results, we will go ahead and combine
     // the values with the keys of all of the records so that the values can
     // be accessed by the key of the rows instead of simply being numeric.
     if (!is_null($key) && count($results) > 0) {
         $keys = $results->fetch($key)->all();
         return array_combine($keys, $values);
     }
     return $values;
 }
Example #2
0
 /**
  * Resolve company users.
  *
  * @param  \Illuminate\Support\Collection $users
  * @param  array $args
  * @return mixed
  */
 public function usersTasks($users, array $args)
 {
     return $users->fetch(['tasks' => function ($q) use($args) {
         $q->loadConnection($args);
     }]);
 }