Illuminate\Support\Collection::map PHP Method

map() public method

Run a map over each of the items.
public map ( callable $callback ) : static
$callback callable
return static
    public function map(callable $callback)
    {
        $keys = array_keys($this->items);
        $items = array_map($callback, $this->items, $keys);
        return new static(array_combine($keys, $items));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Reflash message to next session.
  *   
  * @return void
  */
 public function again()
 {
     $this->next = $this->current->map(function ($item) {
         return $item->toArray();
     })->merge($this->next)->toArray();
     $this->session->keep([$this->key]);
 }
All Usage Examples Of Illuminate\Support\Collection::map