update aso
This commit is contained in:
@@ -218,19 +218,24 @@ class CorporateService
|
|||||||
if (!empty($row['budget']) && !in_array($budget_aso)) {
|
if (!empty($row['budget']) && !in_array($budget_aso)) {
|
||||||
throw new ImportRowException(__('plan.MAX_FREQUENCY'), 0, null, $row);
|
throw new ImportRowException(__('plan.MAX_FREQUENCY'), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (empty($row['limit_free_tc'])){
|
||||||
|
// throw new ImportRowException(__('plan.REQUIRED', [
|
||||||
|
// 'attribute' => 'Limit Free TC'
|
||||||
|
// ]), 0, null, $row);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleBenefitRow(Corporate $corporate, $row)
|
public function handleBenefitRow(Corporate $corporate, $row)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
// $row['limit_free_tc'] = 0;
|
||||||
$benefit_data = $row;
|
$benefit_data = $row;
|
||||||
$this->validateBenefitRow($benefit_data, $corporate->id);
|
$this->validateBenefitRow($benefit_data, $corporate->id);
|
||||||
$benefit_data["corporate_id"] = $corporate->id;
|
$benefit_data["corporate_id"] = $corporate->id;
|
||||||
$plan = $corporate->plans()
|
$plan = $corporate->plans()
|
||||||
->where('corporate_plan_id', $benefit_data['plan_code'])
|
->where('corporate_plan_id', $benefit_data['plan_code'])
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
// $corporate->plans->where('corporate_plan_id', $benefit_data['plan_code'])->first();
|
|
||||||
$benefit_data['plan_code'] = $plan->id;
|
$benefit_data['plan_code'] = $plan->id;
|
||||||
|
|
||||||
$benefit = Benefit::updateOrCreate([
|
$benefit = Benefit::updateOrCreate([
|
||||||
@@ -241,10 +246,10 @@ class CorporateService
|
|||||||
'service_code' => $plan->service_code,
|
'service_code' => $plan->service_code,
|
||||||
'description' => $benefit_data['description'],
|
'description' => $benefit_data['description'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$corporateBenefit = $corporate->corporateBenefits()->updateOrCreate([
|
$corporateBenefit = $corporate->corporateBenefits()->updateOrCreate([
|
||||||
'benefit_id' => $benefit->id,
|
'benefit_id' => $benefit->id,
|
||||||
'plan_id' => $plan->id
|
'plan_id' => $plan->id,
|
||||||
|
'corporate_id' => $corporate->id,
|
||||||
], $benefit_data);
|
], $benefit_data);
|
||||||
|
|
||||||
return $corporateBenefit;
|
return $corporateBenefit;
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('corporate_benefits', function (Blueprint $table) {
|
||||||
|
$table->string('limit_free_tc', 255)->nullable()->default(null)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('corporate_benefits', function (Blueprint $table) {
|
||||||
|
$table->integer('limit_free_tc')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user