diff --git a/app/Http/Controllers/Customer/CartController.php b/app/Http/Controllers/Customer/CartController.php index 4f65b1d..b27e435 100644 --- a/app/Http/Controllers/Customer/CartController.php +++ b/app/Http/Controllers/Customer/CartController.php @@ -142,7 +142,9 @@ class CartController extends Controller 'entity_id' => $voucher->id, 'price' => $voucher->validate_price, 'quantity' => 1, - 'additional_info_json' => json_encode($item), + 'additional_info_json' => json_encode([ + 'voucher' => $voucher->load(['locationProfile.location']) + ]), ]); $voucher->update(['is_sold' => Voucher::SOLD]); diff --git a/app/Models/Voucher.php b/app/Models/Voucher.php index 4b5bbaa..ca870d3 100644 --- a/app/Models/Voucher.php +++ b/app/Models/Voucher.php @@ -143,12 +143,12 @@ class Voucher extends Model ['location_profile_id', '=', $this->location_profile_id], ])->count(); - $treshold = $this->location_profile->min_stock; + $treshold = $this->locationProfile->min_stock; if ($count <= $treshold) { Notification::create([ 'entity_type' => User::class, - 'description' => 'stok voucher ' . $this->location_profile->name . 'tersisa : ' . $count, + 'description' => 'stok voucher ' . $this->locationProfile->name . 'tersisa : ' . $count, ]); } }