Works for friday & saturday
This commit is contained in:
@@ -99,7 +99,7 @@ class Articles
|
||||
case 'App\Models\Botanic\Variety':
|
||||
$variety = $article->product;
|
||||
$specie = $variety->specie;
|
||||
$description = $specie->description . $variety->description;
|
||||
$description = $specie->description . $variety->description;
|
||||
break;
|
||||
case 'App\Models\Botanic\Specie':
|
||||
$specie = $article->product;
|
||||
@@ -160,6 +160,9 @@ class Articles
|
||||
$data[$article->name][$article_nature_name] = self::getDataPriceForSale($article, $prices);
|
||||
}
|
||||
}
|
||||
if ($data ?? false) {
|
||||
ksort($data);
|
||||
}
|
||||
return $data ?? false;
|
||||
}
|
||||
|
||||
@@ -189,13 +192,9 @@ class Articles
|
||||
|
||||
public static function getArticlesWithOffers($options = false)
|
||||
{
|
||||
$category_id = $options['category_id'] ?? false;
|
||||
$sale_channel_id = $options['sale_channel_id'] ?? SaleChannels::getDefaultID();
|
||||
$tags = $options['tags'] ?? false;
|
||||
$model = ($options['homepage'] ?? false) ? Article::homepage()->visible() : Article::visible();
|
||||
|
||||
// exit;
|
||||
$data = $model->byCategoryParent($category_id)->byTags($tags)->withAvailableOffers($sale_channel_id)->with([
|
||||
$model = self::getModelByOptions($options);
|
||||
$data = $model->withAvailableOffers($sale_channel_id)->with([
|
||||
'image',
|
||||
'product',
|
||||
'article_nature',
|
||||
@@ -214,6 +213,21 @@ class Articles
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getModelByOptions($options = false)
|
||||
{
|
||||
$category_id = $options['category_id'] ?? false;
|
||||
$search = $options['search'] ?? false;
|
||||
$tags = $options['tags'] ?? false;
|
||||
$article_nature_id = $options['article_nature_id'] ?? false;
|
||||
|
||||
$model = ($options['homepage'] ?? false) ? Article::homepage()->visible() : Article::visible();
|
||||
$model = $category_id ? $model->byCategoryParent($category_id) : $model;
|
||||
$model = $tags ? $model->byTagsSelected($tags) : $model;
|
||||
$model = $search ? $model->search($search) : $model;
|
||||
$model = $article_nature_id ? $model->byArticleNature($article_nature_id) : $model;
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getFull($id)
|
||||
{
|
||||
$data['article'] = self::getArticleEdit($id);
|
||||
|
||||
14
app/Repositories/Shop/Searches.php
Normal file
14
app/Repositories/Shop/Searches.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Article;
|
||||
|
||||
class Searches
|
||||
{
|
||||
public static function getResults($options)
|
||||
{
|
||||
$data = Articles::getArticlesToSell($options);
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,7 @@ class TagGroups
|
||||
|
||||
public static function getWithTagsAndCountOffers($category_id = false)
|
||||
{
|
||||
$tags = Tag::withCount(['articles' => function($query) use ($category_id) {
|
||||
$query->byCategory($category_id);
|
||||
}])->get()->toArray();
|
||||
$tags = Tag::withCountArticlesByCategory($category_id)->get()->toArray();
|
||||
$tag_groups = TagGroup::pluck('name', 'id')->toArray();
|
||||
foreach ($tags as $tag) {
|
||||
$data[$tag['tag_group_id']]['name'] = $tag_groups[$tag['tag_group_id']];
|
||||
@@ -82,7 +80,9 @@ class TagGroups
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$model = self::get($id);
|
||||
$data['slug'] = Str::slug($data['name']);
|
||||
if ($data['name'] ?? false) {
|
||||
$data['slug'] = Str::slug($data['name']);
|
||||
}
|
||||
$model->update($data);
|
||||
return $model;
|
||||
}
|
||||
@@ -91,4 +91,9 @@ class TagGroups
|
||||
{
|
||||
return TagGroup::destroy($id);
|
||||
}
|
||||
|
||||
public static function toggleVisible($id, $visible)
|
||||
{
|
||||
return self::update(['visible' => $visible], $id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class Tags
|
||||
|
||||
public static function getTagHtml($tag)
|
||||
{
|
||||
return '<span class="btn btn-xs btn-secondary pb-2">' . self::getFullnameByTag($tag) . '</span>';
|
||||
return '<span class="btn btn-xs btn-secondary pb-2 mr-2 mb-2">' . self::getFullnameByTag($tag) . '</span>';
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
|
||||
Reference in New Issue
Block a user