Fixed bug #1003
This commit is contained in:
parent
64c249983d
commit
a7592b233d
|
|
@ -5,7 +5,7 @@ namespace Webkul\Discount\Helpers;
|
|||
use Webkul\Discount\Repositories\CartRuleRepository as CartRule;
|
||||
use Webkul\Discount\Repositories\CartRuleCartRepository as CartRuleCart;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use Arr;
|
||||
|
||||
class Discount
|
||||
{
|
||||
|
|
@ -113,9 +113,9 @@ class Discount
|
|||
}
|
||||
|
||||
if ($canBeApplied->count()) {
|
||||
$this->save($canBeApplied[0]['rule']);
|
||||
$this->save(array_first($canBeApplied)['rule']);
|
||||
|
||||
return $canBeApplied[0];
|
||||
return array_first($canBeApplied);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -214,12 +214,12 @@ class Discount
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if ($canBeApplied[0]['rule']->use_coupon) {
|
||||
if (array_first($canBeApplied)['rule']->use_coupon) {
|
||||
$useCouponable = true;
|
||||
}
|
||||
}
|
||||
} else if (count($canBeApplied)) {
|
||||
if ($canBeApplied[0]['rule']->use_coupon) {
|
||||
if (array_first($canBeApplied)['rule']->use_coupon) {
|
||||
$useCouponable = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ class CartRuleController extends Controller
|
|||
|
||||
if (isset($coupons)) {
|
||||
$coupons['cart_rule_id'] = $ruleUpdated->id;
|
||||
$coupons['usage_per_customer'] = $data['per_customer']; //0 is for unlimited usage
|
||||
// $coupons['usage_per_customer'] = $data['per_customer']; //0 is for unlimited usage
|
||||
|
||||
$couponUpdated = $ruleUpdated->coupons->update($coupons);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue