diff --git a/app/Http/Controllers/Admin/ConfigController.php b/app/Http/Controllers/Admin/ConfigController.php index 7fbf9694..279383c4 100755 --- a/app/Http/Controllers/Admin/ConfigController.php +++ b/app/Http/Controllers/Admin/ConfigController.php @@ -21,6 +21,17 @@ class ConfigController extends Controller ]); } + public function getThemeTemplate() + { + $path = public_path('theme/'); + $files = array_map(function ($item) use ($path) { + return str_replace($path, '', $item); + }, glob($path . '*')); + return response([ + 'data' => $files + ]); + } + public function setTelegramWebhook(Request $request) { $telegramService = new TelegramService($request->input('telegram_bot_token')); @@ -109,6 +120,7 @@ class ConfigController extends Controller 'epay_key' => config('v2board.epay_key'), ], 'frontend' => [ + 'frontend_theme' => config('v2board.frontend_theme', 'v2board'), 'frontend_theme_sidebar' => config('v2board.frontend_theme_sidebar', 'light'), 'frontend_theme_header' => config('v2board.frontend_theme_header', 'dark'), 'frontend_theme_color' => config('v2board.frontend_theme_color', 'default'), diff --git a/app/Http/Requests/Admin/ConfigSave.php b/app/Http/Requests/Admin/ConfigSave.php index b585c031..5cb29633 100755 --- a/app/Http/Requests/Admin/ConfigSave.php +++ b/app/Http/Requests/Admin/ConfigSave.php @@ -85,6 +85,7 @@ class ConfigSave extends FormRequest 'epay_pid' => '', 'epay_key' => '', // frontend + 'frontend_theme' => '', 'frontend_theme_sidebar' => 'in:dark,light', 'frontend_theme_header' => 'in:dark,light', 'frontend_theme_color' => 'in:default,darkblue,black', diff --git a/app/Http/Routes/AdminRoute.php b/app/Http/Routes/AdminRoute.php index 5b9640a2..23d16c3c 100644 --- a/app/Http/Routes/AdminRoute.php +++ b/app/Http/Routes/AdminRoute.php @@ -15,6 +15,7 @@ class AdminRoute $router->get ('/config/fetch', 'Admin\\ConfigController@fetch'); $router->post('/config/save', 'Admin\\ConfigController@save'); $router->get ('/config/getEmailTemplate', 'Admin\\ConfigController@getEmailTemplate'); + $router->get ('/config/getThemeTemplate', 'Admin\\ConfigController@getThemeTemplate'); $router->post('/config/setTelegramWebhook', 'Admin\\ConfigController@setTelegramWebhook'); // Plan $router->get ('/plan/fetch', 'Admin\\PlanController@fetch'); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 0d563f91..d54a1841 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -23,6 +23,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - $this->app['view']->addNamespace('theme', base_path() . '/public/theme'); + $this->app['view']->addNamespace('theme', public_path() . '/theme'); } }