For some reason this line of code returns ` "message": "Undefined variable $activeTargetValue", I'm wondering why? even though I did a check if activeTarget is_null but didn't work
$activeTarget = CustomerServiceTarget::with('target', 'target.target_type')->where("customer_service_id", auth()->user()->CustomerService->id)->ActiveTarget()->get();
foreach ($activeTarget as $activeTargetValue)
$target['amount'][] = $activeTargetValue->target->amount;
$target['name'][] = $activeTargetValue->target->target_type->name; // here
$contactedCustomersActual = CustomerProcedurePulled::contacted()->count() > 0 ? CustomerProcedurePulled::contacted()->count() : 0;
$contactedCustomersTarget = 0;
if (false !== $contactedCustomersKey = array_search(TargetType::TARGET_TYPE["ContactedCustomers"], $target['name']))
$contactedCustomersTarget = $target['amount'][$contactedCustomersKey];
$usedCouponsActual = CustomerProcedurePulled::usedCoupons()->count() > 0 ? CustomerProcedurePulled::usedCoupons()->count() : 0;
$usedCouponsTarget = 0;
if (false !== $usedCouponsKey = array_search(TargetType::TARGET_TYPE["UsedCoupons"], $target['name']))
$usedCouponsTarget = $target['amount'][$usedCouponsKey];
.. return statement