File tree Expand file tree Collapse file tree 4 files changed +6
-5
lines changed
Expand file tree Collapse file tree 4 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 88 $products -> map (fn ($product ) => [
99 ' id' => $product -> id ,
1010 ' slug' => $product -> slug ,
11- ' image' => $product -> image ,
11+ ' image' => $product -> image ?: ' /img/noimage.png ' ,
1212 ' title' => $product -> title ,
1313 ' price' => $product -> price ,
1414 ' quantity' => $cartItems [$product -> id ][' quantity' ],
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class="grid gap-8 grig-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 p-5"
2020 x-data =" productItem({{ json_encode ([
2121 ' id' => $product -> id ,
2222 ' slug' => $product -> slug ,
23- ' image' => $product -> image ,
23+ ' image' => $product -> image ?: ' /img/noimage.png ' ,
2424 ' title' => $product -> title ,
2525 ' price' => $product -> price ,
2626 ' addToCartUrl' => route (' cart.add' , $product )
@@ -30,7 +30,7 @@ class="border border-1 border-gray-200 rounded-md hover:border-purple-600 transi
3030 <a href =" {{ route (' product.view' , $product -> slug ) } }"
3131 class =" aspect-w-3 aspect-h-2 block overflow-hidden" >
3232 <img
33- src =" {{ $ product-> image } } "
33+ : src =" product. image"
3434 alt =" "
3535 class =" object-cover rounded-lg hover:scale-105 hover:rotate-1 transition-transform"
3636 />
Original file line number Diff line number Diff line change 22 <div x-data =" productItem({{ json_encode ([
33 ' id' => $product -> id ,
44 ' slug' => $product -> slug ,
5- ' image' => $product -> image ,
5+ ' image' => $product -> image ?: ' /img/noimage.png ' ,
66 ' title' => $product -> title ,
77 ' price' => $product -> price ,
88 ' quantity' => $product -> quantity ,
1212 <div class =" lg:col-span-3" >
1313 <div
1414 x-data =" {
15- images: {{ $product -> images -> map (fn ($im ) => $im -> url )} } ,
15+ images: {{ $product -> images -> count () ?
16+ $product -> images -> map (fn ($im ) => $im -> url ) : json_encode ([' /img/noimage.png' ]) } } ,
1617 activeImage: null,
1718 prev() {
1819 let index = this.images.indexOf(this.activeImage);
You can’t perform that action at this time.
0 commit comments