¨4.0.1¨
This commit is contained in:
@@ -12,8 +12,8 @@ use Modules\Media\Entities\File;
|
||||
use Modules\Brand\Entities\Brand;
|
||||
use Modules\Slider\Entities\Slider;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Modules\Product\Entities\Product;
|
||||
use Modules\FlashSale\Entities\FlashSale;
|
||||
use Modules\Product\Repositories\ProductRepository;
|
||||
|
||||
class StorefrontTabs extends Tabs
|
||||
{
|
||||
@@ -50,6 +50,7 @@ class StorefrontTabs extends Tabs
|
||||
->add($this->oneColumnBanner());
|
||||
}
|
||||
|
||||
|
||||
private function general()
|
||||
{
|
||||
return tap(new Tab('general', trans('storefront::storefront.tabs.general')), function (Tab $tab) {
|
||||
@@ -63,18 +64,21 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getPages()
|
||||
{
|
||||
return Page::all()->pluck('name', 'id')
|
||||
->prepend(trans('storefront::storefront.form.please_select'), '');
|
||||
}
|
||||
|
||||
|
||||
private function getSliders()
|
||||
{
|
||||
return Slider::all()->sortBy('name')->pluck('name', 'id')
|
||||
->prepend(trans('storefront::storefront.form.please_select'), '');
|
||||
}
|
||||
|
||||
|
||||
private function logo()
|
||||
{
|
||||
return tap(new Tab('logo', trans('storefront::storefront.tabs.logo')), function (Tab $tab) {
|
||||
@@ -88,6 +92,15 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getMedia($fileId)
|
||||
{
|
||||
return Cache::rememberForever(md5("files.{$fileId}"), function () use ($fileId) {
|
||||
return File::findOrNew($fileId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function menus()
|
||||
{
|
||||
return tap(new Tab('menus', trans('storefront::storefront.tabs.menus')), function (Tab $tab) {
|
||||
@@ -106,12 +119,14 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getMenus()
|
||||
{
|
||||
return Menu::all()->pluck('name', 'id')
|
||||
->prepend(trans('storefront::storefront.form.please_select'), '');
|
||||
}
|
||||
|
||||
|
||||
private function footer()
|
||||
{
|
||||
return tap(new Tab('footer', trans('storefront::storefront.tabs.footer')), function (Tab $tab) {
|
||||
@@ -123,9 +138,10 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function newsletter()
|
||||
{
|
||||
if (! setting('newsletter_enabled')) {
|
||||
if (!setting('newsletter_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -137,12 +153,6 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
private function getMedia($fileId)
|
||||
{
|
||||
return Cache::rememberForever(md5("files.{$fileId}"), function () use ($fileId) {
|
||||
return File::findOrNew($fileId);
|
||||
});
|
||||
}
|
||||
|
||||
private function features()
|
||||
{
|
||||
@@ -152,6 +162,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function productPage()
|
||||
{
|
||||
return tap(new Tab('product_page', trans('storefront::storefront.tabs.product_page')), function (Tab $tab) {
|
||||
@@ -162,6 +173,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function socialLinks()
|
||||
{
|
||||
return tap(new Tab('social_links', trans('storefront::storefront.tabs.social_links')), function (Tab $tab) {
|
||||
@@ -181,6 +193,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function sliderBanners()
|
||||
{
|
||||
return tap(new Tab('slider_banners', trans('storefront::storefront.tabs.slider_banners')), function (Tab $tab) {
|
||||
@@ -191,6 +204,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function threeColumnFullWidthBanners()
|
||||
{
|
||||
return tap(new Tab('three_column_full_width_banners', trans('storefront::storefront.tabs.three_column_full_width_banners')), function (Tab $tab) {
|
||||
@@ -201,6 +215,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function featuredCategories()
|
||||
{
|
||||
return tap(new Tab('featured_categories', trans('storefront::storefront.tabs.featured_categories')), function (Tab $tab) {
|
||||
@@ -216,6 +231,13 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getProductListFromSetting($key)
|
||||
{
|
||||
return ProductRepository::list(setting($key, []));
|
||||
}
|
||||
|
||||
|
||||
private function productTabsOne()
|
||||
{
|
||||
return tap(new Tab('product_tabs_one', trans('storefront::storefront.tabs.product_tabs_one')), function (Tab $tab) {
|
||||
@@ -229,9 +251,10 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function topBrands()
|
||||
{
|
||||
if (! auth()->user()->hasAccess(['admin.brands.index'])) {
|
||||
if (!auth()->user()->hasAccess(['admin.brands.index'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -243,6 +266,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function flashSaleAndVerticalProducts()
|
||||
{
|
||||
return tap(new Tab('flash_sale_and_vertical_products', trans('storefront::storefront.tabs.flash_sale_and_vertical_products')), function (Tab $tab) {
|
||||
@@ -256,12 +280,14 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function getFlashSales()
|
||||
{
|
||||
return FlashSale::all()->pluck('campaign_name', 'id')
|
||||
->prepend(trans('admin::admin.form.please_select'), '');
|
||||
}
|
||||
|
||||
|
||||
private function twoColumnBanners()
|
||||
{
|
||||
return tap(new Tab('two_column_banners', trans('storefront::storefront.tabs.two_column_banners')), function (Tab $tab) {
|
||||
@@ -272,6 +298,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function productGrid()
|
||||
{
|
||||
return tap(new Tab('product_grid', trans('storefront::storefront.tabs.product_grid')), function (Tab $tab) {
|
||||
@@ -285,6 +312,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function threeColumnBanners()
|
||||
{
|
||||
return tap(new Tab('three_column_banners', trans('storefront::storefront.tabs.three_column_banners')), function (Tab $tab) {
|
||||
@@ -295,6 +323,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function productTabsTwo()
|
||||
{
|
||||
return tap(new Tab('product_tabs_two', trans('storefront::storefront.tabs.product_tabs_two')), function (Tab $tab) {
|
||||
@@ -308,6 +337,7 @@ class StorefrontTabs extends Tabs
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private function oneColumnBanner()
|
||||
{
|
||||
return tap(new Tab('one_column_banner', trans('storefront::storefront.tabs.one_column_banner')), function (Tab $tab) {
|
||||
@@ -317,9 +347,4 @@ class StorefrontTabs extends Tabs
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
private function getProductListFromSetting($key)
|
||||
{
|
||||
return Product::list(setting($key, []));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user