pluck() public method

Get an array with the values of a given column.
public pluck ( string $column, string | null $key = null ) : Collection
$column string
$key string | null
return Illuminate\Support\Collection
 public function pluck($value, $key = null)
 {
     $this->newQuery();
     $lists = $this->query->pluck($value, $key);
     if (is_array($lists)) {
         return $lists;
     }
     return $lists->all();
 }
 /**
  * @param  string $value
  * @param  string $key
  * @return array
  */
 public function pluck($value, $key = null)
 {
     $this->applyCriteria();
     $lists = $this->model->pluck($value, $key);
     if (is_array($lists)) {
         return $lists;
     }
     return $lists->all();
 }
Example #3
0
 /**
  * Get a single column's value from the first result of a query.
  * 
  * This is an alias for the "value" method.
  *
  * @param string $column
  * @return mixed 
  * @deprecated since version 5.1.
  * @static 
  */
 public static function pluck($column)
 {
     return \Illuminate\Database\Eloquent\Builder::pluck($column);
 }
 /**
  * @param string|int $value
  * @param string     $key
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function getList($value, $key = 'id')
 {
     return $this->model->pluck($value, $key);
 }