Skip to content

Commit

Permalink
Merge pull request #96 from rachana-webkul/master
Browse files Browse the repository at this point in the history
store user validation fixed
  • Loading branch information
vivek-webkul authored Jul 21, 2023
2 parents 585fad9 + 90ff304 commit f9cac69
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
9 changes: 4 additions & 5 deletions src/Http/Controllers/V1/Admin/Setting/SliderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function store(Request $request)
$data['locale'] = implode(',', $data['locale']);
}

$result = $this->getRepositoryInstance()->save($data);
$result = $this->getRepositoryInstance()->create($data);

if ($result) {
$slider = $this->getRepositoryInstance()->latest('id')->first();
Expand Down Expand Up @@ -96,10 +96,9 @@ public function update(Request $request, $id)
return response([
'message' => __('rest-api::app.common-response.error.something-went-wrong'),
], 500);
}

$result = $this->getRepositoryInstance()->updateItem($data, $id);

}

$result = $this->getRepositoryInstance()->update($data, $id);
if ($result) {
return response([
'data' => $this->getRepositoryInstance()->find($id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function store(Request $request)

$taxCategory = $this->getRepositoryInstance()->create($data);

$this->getRepositoryInstance()->attachOrDetach($taxCategory, $data['taxrates']);
$taxCategory->tax_rates()->sync($data['taxrates']);

return response([
'data' => new TaxCategoryResource($this->getRepositoryInstance()->find($taxCategory->id)),
Expand Down Expand Up @@ -75,9 +75,7 @@ public function update(Request $request, $id)

$taxCategory = $this->getRepositoryInstance()->update($data, $id);

$taxRates = $data['taxrates'];

$this->getRepositoryInstance()->attachOrDetach($taxCategory, $taxRates);
$taxCategory->tax_rates()->sync($data['taxrates']);

return response([
'data' => new TaxCategoryResource($this->getRepositoryInstance()->find($taxCategory->id)),
Expand Down
1 change: 0 additions & 1 deletion src/Http/Controllers/V1/Admin/Setting/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public function resource()
public function store(UserForm $request)
{
$data = $request->all();

if (isset($data['password']) && $data['password']) {
$data['password'] = bcrypt($data['password']);
$data['api_token'] = Str::random(80);
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Resources/V1/Shop/Catalog/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ private function specialPriceInfo()

return [
'special_price' => $this->when(
$productTypeInstance ->haveSpecialPrice(),
$productTypeInstance ->haveDiscount(),
core()->convertPrice($productTypeInstance->getMinimalPrice())
),
'formatted_special_price' => $this->when(
$productTypeInstance->haveSpecialPrice(),
$productTypeInstance->haveDiscount(),
core()->currency($productTypeInstance->getMinimalPrice())
),
'regular_price' => $this->when(
$productTypeInstance->haveSpecialPrice(),
$productTypeInstance->haveDiscount(),
data_get($productTypeInstance->getProductPrices(), 'regular_price.price')
),
'formatted_regular_price' => $this->when(
$productTypeInstance->haveSpecialPrice(),
$productTypeInstance->haveDiscount(),
data_get($productTypeInstance->getProductPrices(), 'regular_price.formated_price')
),
];
Expand Down

0 comments on commit f9cac69

Please sign in to comment.