Illuminate\Support\Collection::pluck PHP Method

pluck() public method

Get the values of a given key.
public pluck ( string $value, string | null $key = null ) : static
$value string
$key string | null
return static
    public function pluck($value, $key = null)
    {
        return new static(Arr::pluck($this->items, $value, $key));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Merge client info subentity
  * @param  \Illuminate\Support\Collection $clients
  */
 protected function mergeInfo($clients)
 {
     $infos = $this->manager->clientInfo->where('clientID', 'in', $clients->pluck('id'))->get();
     foreach ($infos as $clientID => $info) {
         $clients[$clientID]->info = $info;
     }
 }
All Usage Examples Of Illuminate\Support\Collection::pluck