Fixes on new model
This commit is contained in:
@@ -25,17 +25,27 @@ class ArticleAttributes
|
||||
return ArticleAttribute::find($id);
|
||||
}
|
||||
|
||||
public static function storeAttributes($article_price_id, $attributes)
|
||||
public static function getByArticle($id)
|
||||
{
|
||||
return ArticleAttribute::byArticle($id)->get();
|
||||
}
|
||||
|
||||
public static function getByArticleWithPrices($id)
|
||||
{
|
||||
return ArticleAttribute::with('prices')->byArticle($id)->get();
|
||||
}
|
||||
|
||||
public static function storeAttributes($article_id, $attributes)
|
||||
{
|
||||
foreach ($attributes as $key => $attribute)
|
||||
{
|
||||
self::storeAttribute($article_price_id, $attributes[$key]);
|
||||
self::storeAttribute($article_id, $attributes[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function storeAttribute($article_price_id, $attribute)
|
||||
public static function storeAttribute($article_id, $attribute)
|
||||
{
|
||||
$attribute['article_price_id'] = $article_price_id;
|
||||
$attribute['article_id'] = $article_id;
|
||||
unset($attribute['attribute_family_id']);
|
||||
return self::store($attribute);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user