alabtechnosoft
OrderController and RestaurantOwnerController .......
if ($order->coupon_name) {
$coupon = Coupon::where('code', $order->coupon_name)->first();
if ($coupon) {
$coupon->count = $coupon->count - 1;
$coupon->save();
}
}
if ($order->coupon_name) {
$coupon = Coupon::where('code', $order->coupon_name)->first();
if ($coupon->user_type == 'ONCE'||$coupon->user_type == 'CUSTOM') {
if ($coupon) {
$order->coupon_name = null;
$order->save();
}
}
}