PHP Laravel Gallery split array into 3 columns
I’m would like to have this effect:
<div class="w3-third">
Images tags here
</div>
<div class="w3-third">
Images tags here
</div>
<div class="w3-third">
Images tags here
</div>
I have this php code:
$images = Image::where('gallery_id', $id)->get();
$list = [];
foreach ($images as $image) {
array_push($list, $image->file_path);
}
$list = array_chunk($list, 3);
return view('gallery.gallery')
->with([
'gallery' => $gallery,
'images' => $list
]);
And i want to push images from this list into those 3 columns.
from Laravel Questions and Answers https://laravelquestions.com/php/php-laravel-gallery-split-array-into-3-columns/
via Lzo Media
No comments:
Post a Comment