mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
fix booting option repository at setup
This commit is contained in:
parent
429dc7c7a7
commit
7f79a654bd
@ -213,7 +213,7 @@ class PluginManager
|
||||
*/
|
||||
public function getEnabled()
|
||||
{
|
||||
return json_decode($this->option->get('plugins_enabled'), true);
|
||||
return (array) json_decode($this->option->get('plugins_enabled'), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@ namespace App\Services\Repositories;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class OptionRepository extends Repository
|
||||
{
|
||||
@ -21,7 +22,11 @@ class OptionRepository extends Repository
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$options = DB::table('options')->get();
|
||||
} catch (QueryException $e) {
|
||||
$options = [];
|
||||
}
|
||||
|
||||
foreach ($options as $option) {
|
||||
$this->items[$option->option_name] = $option->option_value;
|
||||
@ -75,6 +80,7 @@ class OptionRepository extends Repository
|
||||
{
|
||||
$this->items_modified = array_unique($this->items_modified);
|
||||
|
||||
try {
|
||||
foreach ($this->items_modified as $key) {
|
||||
if (!DB::table('options')->where('option_name', $key)->first()) {
|
||||
DB::table('options')
|
||||
@ -85,6 +91,9 @@ class OptionRepository extends Repository
|
||||
->update(['option_value' => $this[$key]]);
|
||||
}
|
||||
}
|
||||
} catch (QueryException $e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,7 @@ $app->bind('url', function ($app) {
|
||||
$app->instance('request', $request);
|
||||
|
||||
$app->singleton('database', App\Services\Database\Database::class);
|
||||
$app->singleton('option', App\Services\OptionRepository::class);
|
||||
$app->singleton('option', App\Services\Repositories\OptionRepository::class);
|
||||
|
||||
View::addExtension('tpl', 'blade');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user