Fix Benefit Import

This commit is contained in:
R
2022-12-14 12:13:54 +07:00
parent ad090112eb
commit 9ae069718e

View File

@@ -88,15 +88,17 @@ class CorporateService
$benefit_data["corporate_id"] = $corporate->id;
$this->validateBenefitRow($benefit_data);
$plan = Plan::where('corporate_id', $corporate->id)->where('corporate_plan_id', $benefit_data['plan_code'])->first();
$benefit_data['plan_code'] = $plan->id;
$plan = Benefit::updateOrCreate([
$benefit = Benefit::updateOrCreate([
'service_code' => $benefit_data['service_code'],
'plan_code' => $benefit_data['plan_code'],
'corporate_id' => $corporate->id,
'code' => $benefit_data['code'],
], $benefit_data);
return $plan;
return $benefit;
} catch (\Exception $e) {
throw $e;
}