Which line throws the error?
Nov 15, 2021
12
Level 1
A non-numeric value encountered
$popular = Search::orderBy('frequency', 'desc')->pluck('query')->all();
$popularProduct = Product::with('thumbnail', 'reviews', 'deals')->get();
foreach ($popular as $key => $value) {
$popularProduct->where('name', 'like', '%' . $value . '%');
}
$popularProduct = $popularProduct->where('status', 1)->shuffle()->take(5);
blade file
{{ $popularProduct[4]->pricing_scheme->price * Session::get('currentCurrency')->rate }}</span>
appserviceprovider boot method
$currency = Currency::where('code', 'USD')->first();
if (!session()->has('currentCurrency')) {
session()->put('currentCurrency', $currency);
}
while dd($popular);
array:78 [▼
0 => "skybag"
1 => "pant"
2 => "Shoe"
3 => "Man's pant"
4 => "Track Jogger Pants for man"
5 => "One Piece dress for girl"
6 => "pants"
7 => "dress"
8 => "clothing"
9 => "carpet"
10 => "goat"
11 => "Led tv"
12 => "tshirt"
13 => "bil"
14 => "Fortuna 26MTB 2WD"
15 => "bike"
16 => "t-shirt"
17 => "hwt"
18 => "sneaker"
19 => "bag"
20 => "Old Car"
21 => "test"
22 => "track"
23 => "2wd"
24 => "car"
25 => "Printed"
26 => "Mini tractor"
27 => "shirt"
28 => "bicycle"
29 => "Wireless Earphone"
30 => "Brass cooker and kitchenwere"
31 => "Garjoo Taiwan"
32 => "bed"
33 => "hotel"
34 => "Narayan Prasad Dhital"
35 => "fortuna"
36 => "ewewer"
37 => "chair"
38 => "Annimal"
39 => "vehicle"
40 => "Escort"
41 => "Track Jogger Pants for man"
42 => "Philips 8.5 W Round B22 LED Bulb"
43 => "Authentic Printed Tee"
44 => "old durbar"
45 => "david"
46 => "Tractor"
47 => "buffalo"
48 => "baby product"
49 => "robot"
50 => "Bluetooth Speaker"
51 => "Khujati"
52 => "wireless"
53 => "Crystal Furnitech Sigma Engineered Wood Coffee Table"
54 => "Dabur Chyawanprash 500 Gm"
55 => "Jhummar"
56 => "t"
57 => "FOOTWEAR"
58 => "tshi"
59 => "nara"
60 => "Carpt"
61 => "Basketball Sneaker"
62 => "gf"
63 => "pan"
64 => "garjoo"
65 => "shoesn"
66 => "dhital"
67 => "sho"
68 => "conv"
69 => "furn"
70 => "carp"
71 => "plastic peni"
72 => "you make"
73 => "jogg"
74 => "wine"
75 => "head"
76 => "Printed t-shirt"
77 => "333"
]
while dd($popularProduct)
Illuminate\Database\Eloquent\Collection {#2062 ▼
#items: array:5 [▶]
#escapeWhenCastingToString: false
}
how can i resolve this
Level 55
@freemium if you hit your url seeveral times you'll see that it shows different id of popular product. which means for one of product you have wrong value
can you check the price of all pricing schemas manually in database?
Please or to participate in this conversation.