bugfix same code on process cart

dev
Aji Kamaludin 1 year ago
parent 1363f5ba1a
commit e799de83e5
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

@ -142,7 +142,9 @@ class CartController extends Controller
'entity_id' => $voucher->id, 'entity_id' => $voucher->id,
'price' => $voucher->validate_price, 'price' => $voucher->validate_price,
'quantity' => 1, 'quantity' => 1,
'additional_info_json' => json_encode($item), 'additional_info_json' => json_encode([
'voucher' => $voucher->load(['locationProfile.location'])
]),
]); ]);
$voucher->update(['is_sold' => Voucher::SOLD]); $voucher->update(['is_sold' => Voucher::SOLD]);

@ -143,12 +143,12 @@ class Voucher extends Model
['location_profile_id', '=', $this->location_profile_id], ['location_profile_id', '=', $this->location_profile_id],
])->count(); ])->count();
$treshold = $this->location_profile->min_stock; $treshold = $this->locationProfile->min_stock;
if ($count <= $treshold) { if ($count <= $treshold) {
Notification::create([ Notification::create([
'entity_type' => User::class, 'entity_type' => User::class,
'description' => 'stok voucher ' . $this->location_profile->name . 'tersisa : ' . $count, 'description' => 'stok voucher ' . $this->locationProfile->name . 'tersisa : ' . $count,
]); ]);
} }
} }

Loading…
Cancel
Save