Update TaxCategoryController.php

This commit is contained in:
Iman 2018-12-01 10:48:19 +03:30 committed by GitHub
parent 51baeeb0b9
commit 264bc14ed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 12 deletions

View File

@ -144,21 +144,22 @@ class TaxCategoryController extends Controller
]);
$data = request()->input();
$taxCategory = $this->taxCategory->update($data, $id);
if($taxCategory = $this->taxCategory->update($data, $id)) {
$taxRates = $data['taxrates'];
//attach the categories in the tax map table
$this->taxCategory->attachOrDetach($taxCategory, $taxRates);
session()->flash('success', trans('admin::app.settings.tax-categories.update-success'));
return redirect()->route($this->_config['redirect']);
} else {
if(!$taxCategory) {
session()->flash('error', trans('admin::app.settings.tax-categories.update-error'));
return redirect()->back();
}
$taxRates = $data['taxrates'];
//attach the categories in the tax map table
$this->taxCategory->attachOrDetach($taxCategory, $taxRates);
session()->flash('success', trans('admin::app.settings.tax-categories.update-success'));
return redirect()->route($this->_config['redirect']);
}
/**
@ -179,4 +180,4 @@ class TaxCategoryController extends Controller
return redirect()->back();
}
}
}