fixed plugin status
This commit is contained in:
parent
0a8d86fce8
commit
19a141a9c9
|
|
@ -43,11 +43,7 @@ class SettingRepo
|
||||||
|
|
||||||
public static function getPluginStatus($pluginCode): bool
|
public static function getPluginStatus($pluginCode): bool
|
||||||
{
|
{
|
||||||
$status = Setting::query()
|
$status = setting("bk.{$pluginCode}");
|
||||||
->where('type', 'plugin')
|
|
||||||
->where('space', $pluginCode)
|
|
||||||
->where('name', 'status')
|
|
||||||
->value('value');
|
|
||||||
return (bool)$status;
|
return (bool)$status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,24 @@ class ShopServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
protected function loadSettings()
|
protected function loadSettings()
|
||||||
{
|
{
|
||||||
$settings = Setting::all(['name', 'value', 'json'])
|
$settings = Setting::all(['type', 'space', 'name', 'value', 'json'])
|
||||||
->keyBy('name')
|
->groupBy('space');
|
||||||
->transform(function ($setting) {
|
|
||||||
if ($setting->json) {
|
$result = [];
|
||||||
return \json_decode($setting->value, true);
|
foreach ($settings as $space => $groupSettings) {
|
||||||
|
$space = $space ?: 'system';
|
||||||
|
foreach ($groupSettings as $groupSetting) {
|
||||||
|
$name = $groupSetting->name;
|
||||||
|
$value = $groupSetting->value;
|
||||||
|
if ($groupSetting->json) {
|
||||||
|
|
||||||
|
$result[$space][$name] = json_encode($value);
|
||||||
|
} else {
|
||||||
|
$result[$space][$name] = $value;
|
||||||
}
|
}
|
||||||
return $setting->value;
|
}
|
||||||
})
|
}
|
||||||
->toArray();
|
config(['bk' => $result]);
|
||||||
config(['bk' => $settings]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function registerGuard()
|
protected function registerGuard()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue