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

@@ -30,6 +30,7 @@ class Articles
$data = $article->toArray();
$data['categories'] = self::getCategoriesByArticle($article);
$data['tags'] = self::getTagsByArticle($article);
// $data['attributes'] = self::getAttributesByArticle($article);
$data['prices'] = self::getPricesByArticle($article);
self::getMeta($data);
return $data;
@@ -56,9 +57,14 @@ class Articles
return $article->tags->pluck('id')->toArray();
}
public static function getAttributesByArticle($article)
{
return ArticleAttributes::getByArticleWithPrices($article->id)->toArray();
}
public static function getPricesByArticle($article)
{
return ArticlePrices::getPricesByArticle($article->id);
return ArticlePrices::getByArticleWithAttribute($article->id)->toArray();
}
public static function get($id)