Merge pull request #255 from imanghafoori1/master

Update TaxCategoryController.php -> PR #255 accepted.
This commit is contained in:
Prashant Singh 2018-12-03 13:47:59 +05:30 committed by GitHub
commit f546cfce30
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();
}
}
}