This commit is contained in:
diashalabi 2021-07-15 12:54:12 +03:00
parent 930eede804
commit cf6029e453
5 changed files with 0 additions and 67 deletions

View File

@ -16,7 +16,6 @@ return [
'free_currencyconverterapi_key',
'hide_price_categories',
'tcmb_exchange_url',
'enabled_modules',
'enabled_currencies',
'disable_sentry',
'hide_ad_cat',

View File

@ -194,22 +194,6 @@ return [
},
],
],
'enabled_modules' => [
'type' => 'anomaly.field_type.checkboxes',
'config' => [
'mode' => 'tags',
'default_value' => function () {
$addons = app('module.collection')->enabled()->pluck('namespace')->all();
return $addons;
},
'options' => function () {
$addons = app('module.collection')->pluck('namespace', 'namespace');
return $addons;
},
],
],
'market_place' => [
'type' => 'anomaly.field_type.boolean',
'config' => [

View File

@ -125,10 +125,6 @@ return [
'enabled_currencies' => [
'name' => 'Enabled Currencies',
],
'enabled_modules' => [
'name' => 'Enabled Modules',
'warning' => 'Change at your own risk.',
],
'google_statistic_code' => [
'name' => 'Google Statistic Code',
],

View File

@ -2,13 +2,11 @@
use Anomaly\Streams\Platform\Addon\AddonServiceProvider;
use Anomaly\Streams\Platform\Ui\ControlPanel\Component\Navigation\Event\SortNavigation;
use Anomaly\Streams\Platform\Ui\Form\Event\FormWasSaved;
use Anomaly\Streams\Platform\Ui\Table\Event\TableIsQuerying;
use Illuminate\Pagination\AbstractPaginator;
use Visiosoft\DefaultadminTheme\Listener\AddGsmFilter;
use Visiosoft\DefaultadminTheme\Listener\AddViewAdsButton;
use Visiosoft\DefaultadminTheme\Listener\ApplySorting;
use Visiosoft\DefaultadminTheme\Listener\CheckEnabledModules;
/**
* Class DefaultadminThemeServiceProvider
@ -27,9 +25,6 @@ class DefaultadminThemeServiceProvider extends AddonServiceProvider
AddGsmFilter::class,
AddViewAdsButton::class,
],
FormWasSaved::class => [
CheckEnabledModules::class,
],
];
protected $overrides = [

View File

@ -1,41 +0,0 @@
<?php namespace Visiosoft\DefaultadminTheme\Listener;
use Anomaly\SettingsModule\Setting\Form\SettingFormBuilder;
use Anomaly\Streams\Platform\Addon\Module\Command\InstallModule;
use Anomaly\Streams\Platform\Addon\Module\Command\UninstallModule;
use Anomaly\Streams\Platform\Addon\Module\Contract\ModuleRepositoryInterface;
use Anomaly\Streams\Platform\Ui\Form\Event\FormWasSaved;
use Illuminate\Foundation\Bus\DispatchesJobs;
class CheckEnabledModules
{
use DispatchesJobs;
private $moduleRepository;
public function __construct(ModuleRepositoryInterface $moduleRepository)
{
$this->moduleRepository = $moduleRepository;
}
public function handle(FormWasSaved $event)
{
$builder = $event->getBuilder();
if (get_class($builder) == SettingFormBuilder::class) {
$value = $builder->getFormFields()->where('field', 'enabled_modules')->first()->getValue();
$disabledModules = app('module.collection')->whereNotIn('namespace', $value);
$enabledModules = app('module.collection')->whereIn('namespace', $value);
foreach ($disabledModules as $module) {
if ($module->isInstalled()) {
$this->dispatchNow(new UninstallModule($module, true));
}
}
foreach ($enabledModules as $module) {
if (!$module->isInstalled()) {
$this->dispatchNow(new InstallModule($module, true));
}
}
}
}
}