Skip to content

Commit

Permalink
fixed bug props name change error [safe name change]
Browse files Browse the repository at this point in the history
  • Loading branch information
A1Gard committed Jan 12, 2025
1 parent b7c6751 commit 0311d71
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Http/Controllers/Admin/PropController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,19 @@ public function destroy(Prop $item)
}


private function updateName($item, $request)
{
if ($item->name != $request->input('name') && $request->input('name') != ''){
foreach (Product::whereHasMeta($item->name)->get() as $product){
$product->setMeta($request->input('name'),$product->getMeta($item->name));
$product->removeMeta($item->name);
}
}
}

public function update(Request $request, Prop $item)
{
$this->updateName($item, $request);
return $this->bringUp($request, $item);
}

Expand Down

0 comments on commit 0311d71

Please sign in to comment.