Fixes on new model

This commit is contained in:
Ludovic CANDELLIER
2020-07-26 23:17:49 +02:00
parent 4de381db06
commit 71e27ce9c3
19 changed files with 116 additions and 55 deletions

View File

@@ -13,9 +13,14 @@ use App\Models\Shop\ArticlePrice;
class ArticlePrices
{
public static function getPricesByArticle($id)
public static function getByArticle($id)
{
return ArticlePrice::with('ArticleAttributes.Value')->byArticle($id)->get()->toArray();
return ArticlePrice::byArticle($id)->get();
}
public static function getByArticleWithAttribute($id)
{
return ArticlePrice::with('article_attribute')->byArticle($id)->get();
}
public static function getDatatable()
@@ -34,11 +39,11 @@ class ArticlePrices
return ArticlePrice::find($id);
}
public static function storePrices($article_id, $prices)
public static function storePrices($article_attribute_id, $prices)
{
if ($prices) {
foreach ($prices as $key => $price) {
$prices[$key]['article_id'] = $article_id;
$prices[$key]['article_attribute_id'] = $article_attribute_id;
self::store($prices[$key]);
}
} else {