Add exports & fix on edition
This commit is contained in:
@@ -64,8 +64,10 @@ class ArticleAttributes
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $id : $data['id'];
|
||||
return ArticleAttribute::find($id)->update($data);
|
||||
$id = isset($data['id']) ? $data['id'] : $id;
|
||||
$item = ArticleAttribute::find($id);
|
||||
$item->update($data);
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
|
||||
@@ -39,11 +39,15 @@ class ArticlePrices
|
||||
return ArticlePrice::find($id);
|
||||
}
|
||||
|
||||
public static function storePrices($article_attribute_id, $prices)
|
||||
public static function storePrices($article_id, $prices)
|
||||
{
|
||||
if ($prices) {
|
||||
foreach ($prices as $key => $price) {
|
||||
$prices[$key]['article_attribute_id'] = $article_attribute_id;
|
||||
$price['article_attribute']['article_attribute_value_id'] = $price['attribute']['attribute_value_id'];
|
||||
$prices[$key]['article_attribute_id'] = ArticleAttributes::storeAttribute($article_id, $price['article_attribute']);
|
||||
|
||||
unset($prices[$key]['article_attribute']);
|
||||
unset($prices[$key]['attribute']);
|
||||
self::store($prices[$key]);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -87,7 +87,7 @@ class Articles
|
||||
self::storeCategories($article, $categories);
|
||||
self::storeTags($article, $tags);
|
||||
self::storePrices($article, $prices);
|
||||
return $article;
|
||||
return $article_id;
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
|
||||
Reference in New Issue
Block a user