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 8
8
$products -> map (fn ($product ) => [
9
9
' id' => $product -> id ,
10
10
' slug' => $product -> slug ,
11
- ' image' => $product -> image ,
11
+ ' image' => $product -> image ?: ' /img/noimage.png ' ,
12
12
' title' => $product -> title ,
13
13
' price' => $product -> price ,
14
14
' 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"
20
20
x-data =" productItem({{ json_encode ([
21
21
' id' => $product -> id ,
22
22
' slug' => $product -> slug ,
23
- ' image' => $product -> image ,
23
+ ' image' => $product -> image ?: ' /img/noimage.png ' ,
24
24
' title' => $product -> title ,
25
25
' price' => $product -> price ,
26
26
' addToCartUrl' => route (' cart.add' , $product )
@@ -30,7 +30,7 @@ class="border border-1 border-gray-200 rounded-md hover:border-purple-600 transi
30
30
<a href =" {{ route (' product.view' , $product -> slug ) } }"
31
31
class =" aspect-w-3 aspect-h-2 block overflow-hidden" >
32
32
<img
33
- src =" {{ $ product-> image } } "
33
+ : src =" product. image"
34
34
alt =" "
35
35
class =" object-cover rounded-lg hover:scale-105 hover:rotate-1 transition-transform"
36
36
/>
Original file line number Diff line number Diff line change 2
2
<div x-data =" productItem({{ json_encode ([
3
3
' id' => $product -> id ,
4
4
' slug' => $product -> slug ,
5
- ' image' => $product -> image ,
5
+ ' image' => $product -> image ?: ' /img/noimage.png ' ,
6
6
' title' => $product -> title ,
7
7
' price' => $product -> price ,
8
8
' quantity' => $product -> quantity ,
12
12
<div class =" lg:col-span-3" >
13
13
<div
14
14
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' ]) } } ,
16
17
activeImage: null,
17
18
prev() {
18
19
let index = this.images.indexOf(this.activeImage);
You can’t perform that action at this time.
0 commit comments