2016-11-16 9 views
1

Ich habe ein Suchergebnis von image Modell und $photo gespeichert die Daten, die $photo->type == 'photo'.Wie array_values ​​Laravel-Sammlung?

$photo = $image->filter(function($photo,$key) use($path){ 
    if($photo->type == 'photo'){ 
     $photo->url = $path.$photo->image; 
      return $photo; 
    } 
}); 

Hier ist die $photo Sammlung und ist es eine Möglichkeit, array_values() die items Daten?

Collection {#352 ▼ 
    #items: array:3 [▼ 
    2 => ImageBanquet {#349 ▶} 
    3 => ImageBanquet {#350 ▶} 
    4 => ImageBanquet {#351 ▶} 
    ] 
} 
+0

Possible Duplikat [Neuanordnen Arrayindex Eloquent Laravel] (http://stackoverflow.com/questions/27309747/rearrange-array-index-eloquent-laravel) – patricus

Antwort

3

Überprüfen Sie values() Sammlung Helfer.

$values = $collection->values(); 
Verwandte Themen