¨4.0.1¨
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Themes\Storefront\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Themes\Storefront\Banner;
|
||||
use Themes\Storefront\Feature;
|
||||
use Modules\Brand\Entities\Brand;
|
||||
@@ -15,7 +16,8 @@ class HomePageComposer
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param \Illuminate\View\View $view
|
||||
* @param View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose($view)
|
||||
@@ -37,9 +39,10 @@ class HomePageComposer
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
private function featuredCategoriesSection()
|
||||
{
|
||||
if (! setting('storefront_featured_categories_section_enabled')) {
|
||||
if (!setting('storefront_featured_categories_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,10 +53,11 @@ class HomePageComposer
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
private function getFeaturedCategories()
|
||||
{
|
||||
$categoryIds = Collection::times(6, function ($number) {
|
||||
if (! is_null(setting("storefront_featured_categories_section_category_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_featured_categories_section_category_{$number}_product_type"))) {
|
||||
return setting("storefront_featured_categories_section_category_{$number}_category_id");
|
||||
}
|
||||
})->filter();
|
||||
@@ -72,6 +76,7 @@ class HomePageComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function threeColumnFullWidthBanners()
|
||||
{
|
||||
if (setting('storefront_three_column_full_width_banners_enabled')) {
|
||||
@@ -79,22 +84,24 @@ class HomePageComposer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function productTabsOne()
|
||||
{
|
||||
if (! setting('storefront_product_tabs_1_section_enabled')) {
|
||||
if (!setting('storefront_product_tabs_1_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Collection::times(4, function ($number) {
|
||||
if (! is_null(setting("storefront_product_tabs_1_section_tab_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_product_tabs_1_section_tab_{$number}_product_type"))) {
|
||||
return setting("storefront_product_tabs_1_section_tab_{$number}_title");
|
||||
}
|
||||
})->filter();
|
||||
}
|
||||
|
||||
|
||||
private function topBrands()
|
||||
{
|
||||
if (! setting('storefront_top_brands_section_enabled')) {
|
||||
if (!setting('storefront_top_brands_section_enabled')) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
@@ -103,7 +110,7 @@ class HomePageComposer
|
||||
return Cache::rememberForever(md5('storefront_top_brands:' . serialize($topBrandIds)), function () use ($topBrandIds) {
|
||||
return Brand::with('files')
|
||||
->whereIn('id', $topBrandIds)
|
||||
->when(! empty($topBrandIds), function ($query) use ($topBrandIds) {
|
||||
->when(!empty($topBrandIds), function ($query) use ($topBrandIds) {
|
||||
$topBrandIdsString = collect($topBrandIds)->filter()->implode(',');
|
||||
|
||||
$query->orderByRaw("FIELD(id, {$topBrandIdsString})");
|
||||
@@ -118,6 +125,7 @@ class HomePageComposer
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function flashSaleAndVerticalProducts()
|
||||
{
|
||||
return [
|
||||
@@ -128,6 +136,7 @@ class HomePageComposer
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
private function twoColumnBanners()
|
||||
{
|
||||
if (setting('storefront_two_column_banners_enabled')) {
|
||||
@@ -135,19 +144,21 @@ class HomePageComposer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function productGrid()
|
||||
{
|
||||
if (! setting('storefront_product_grid_section_enabled')) {
|
||||
if (!setting('storefront_product_grid_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Collection::times(4, function ($number) {
|
||||
if (! is_null(setting("storefront_product_grid_section_tab_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_product_grid_section_tab_{$number}_product_type"))) {
|
||||
return setting("storefront_product_grid_section_tab_{$number}_title");
|
||||
}
|
||||
})->filter();
|
||||
}
|
||||
|
||||
|
||||
private function threeColumnBanners()
|
||||
{
|
||||
if (setting('storefront_three_column_banners_enabled')) {
|
||||
@@ -155,14 +166,15 @@ class HomePageComposer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function tabProductsTwo()
|
||||
{
|
||||
if (! setting('storefront_product_tabs_2_section_enabled')) {
|
||||
if (!setting('storefront_product_tabs_2_section_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tabs = Collection::times(4, function ($number) {
|
||||
if (! is_null(setting("storefront_product_tabs_2_section_tab_{$number}_product_type"))) {
|
||||
if (!is_null(setting("storefront_product_tabs_2_section_tab_{$number}_product_type"))) {
|
||||
return setting("storefront_product_tabs_2_section_tab_{$number}_title");
|
||||
}
|
||||
})->filter();
|
||||
@@ -173,6 +185,7 @@ class HomePageComposer
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
private function oneColumnBanner()
|
||||
{
|
||||
if (setting('storefront_one_column_banner_enabled')) {
|
||||
|
||||
Reference in New Issue
Block a user