storage url o'zgartirildi
This commit is contained in:
@@ -35,8 +35,8 @@ class Update
|
||||
$category->name = $request->getName();
|
||||
$category->slug = $request->getSlug();
|
||||
$category->position = $request->getPosition();
|
||||
$category->image = $request->getImage($category);
|
||||
// $category->parent_id = $request->getParentId();
|
||||
$category->image = $this->image;
|
||||
$category->parent_id = $request->getParentId();
|
||||
// $category->popular = $request->getPopular();
|
||||
$category->published = $request->getPublished();
|
||||
$category->is_filter_power = $request->getFilterPower();
|
||||
@@ -45,8 +45,6 @@ class Update
|
||||
$category->keywords = $request->keywords;
|
||||
$category->title_seo = $request->title_seo;
|
||||
|
||||
$category->image = $this->image;
|
||||
|
||||
$category->save();
|
||||
|
||||
if (isset($request->brands)) {
|
||||
|
||||
@@ -36,8 +36,10 @@ class Store
|
||||
|
||||
$map = array_map(function ($product) {
|
||||
return $product['id'];
|
||||
}, $this->request->products);
|
||||
}, $this->request->products ?? []);
|
||||
|
||||
$compilation->products()->attach($map);
|
||||
if (!empty($map)) {
|
||||
$compilation->products()->attach($map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,20 +35,12 @@ class Update
|
||||
'category_id' => $this->request->getCategory()
|
||||
]);
|
||||
|
||||
$detach = Compilation::find($this->compilation->id);
|
||||
$detach->loadMissing(['products:id']);
|
||||
|
||||
$compilation = Compilation::find($this->compilation->id);
|
||||
|
||||
$map = array_map(function ($product) {
|
||||
return $product['id'];
|
||||
}, $this->request->products);
|
||||
}, $this->request->products ?? []);
|
||||
|
||||
$detach = array_map(function ($product) {
|
||||
return $product['id'];
|
||||
}, $detach->products->toArray());
|
||||
|
||||
$compilation->products()->detach($detach);
|
||||
$compilation->products()->attach($map);
|
||||
$compilation->products()->sync($map);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user