Add deep relations
This commit is contained in:
@@ -19,7 +19,7 @@ class Articles
|
||||
|
||||
public static function autocomplete($str)
|
||||
{
|
||||
$data = Article::byAutocomplete($str)->orderBy('name')->limit(30)->get()->pluck('name', 'id');
|
||||
$data = Article::byAutocomplete($str)->orderBy('name')->limit(30)->pluck('name', 'id');
|
||||
$export = [];
|
||||
foreach ($data as $key => $name) {
|
||||
$export[] = ['value' => $key, 'text' => $name];
|
||||
@@ -59,9 +59,20 @@ class Articles
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getArticlesToSell()
|
||||
{
|
||||
$articles = self::getArticlesWithOffers();
|
||||
foreach ($articles as $article) {
|
||||
$data[$article->article_nature->name][$article->name][] = [
|
||||
'description' => $article->description,
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getArticlesWithOffers()
|
||||
{
|
||||
return Article::withCurrentOffers()->with('offers')->get();
|
||||
return Article::visible()->withAvailableOffers()->with(['image', 'article_nature', 'offers.tariff.price_lists.price_list_values'])->get();
|
||||
}
|
||||
|
||||
public static function getFull($id)
|
||||
|
||||
Reference in New Issue
Block a user