diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index fc1de27..6b2ad4d 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -105,6 +105,7 @@ class HomeController extends Controller ->get(); }); + Session::put('dark_mode', $settings[0]->dark_mode ?? 0); Session::put('timer_version_footer', $settings[0]->show_versions_footer ?? 1); Session::put('show_servers_public', $settings[0]->show_servers_public ?? 0); Session::put('show_server_value_ip', $settings[0]->show_server_value_ip ?? 0); diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index dfae00f..8f72bbb 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -22,6 +22,7 @@ class SettingsController extends Controller public function update(Request $request, Settings $settings) { $request->validate([ + 'dark_mode' => 'required|boolean', 'show_versions_footer' => 'required|boolean', 'show_server_value_ip' => 'required|boolean', 'show_server_value_hostname' => 'required|boolean', @@ -38,6 +39,7 @@ class SettingsController extends Controller DB::table('settings') ->where('id', 1) ->update([ + 'dark_mode' => $request->dark_mode, 'show_versions_footer' => $request->show_versions_footer, 'show_servers_public' => $request->show_servers_public, 'show_server_value_ip' => $request->show_server_value_ip, @@ -52,6 +54,7 @@ class SettingsController extends Controller 'recently_added_amount' => $request->recently_added_amount ]); + Session::put('dark_mode', $request->dark_mode ?? 1); Session::put('timer_version_footer', $request->show_versions_footer); Session::put('show_servers_public', $request->show_servers_public); Session::put('show_server_value_ip', $request->show_server_value_ip); diff --git a/database/migrations/2022_05_09_154509_add_dark_mode_setting.php b/database/migrations/2022_05_09_154509_add_dark_mode_setting.php new file mode 100644 index 0000000..7384254 --- /dev/null +++ b/database/migrations/2022_05_09_154509_add_dark_mode_setting.php @@ -0,0 +1,19 @@ +boolean('dark_mode')->default(false); + }); + } + + public function down() + { + } +} diff --git a/public/css/bootstrap-dark.min.css b/public/css/bootstrap-dark.min.css new file mode 100644 index 0000000..86f36bc Binary files /dev/null and b/public/css/bootstrap-dark.min.css differ diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index d3da691..17f71c4 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -10,7 +10,12 @@ @yield('title') - @if (config()->has('app.name')) {{ config('app.name') }} @else My idlers @endif - + @if(Session::get('dark_mode')) + + @else + + @endif + @yield('css_links') diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php index ebfa76b..5ca3e47 100644 --- a/resources/views/settings/index.blade.php +++ b/resources/views/settings/index.blade.php @@ -17,6 +17,22 @@
@csrf @method('PUT') +
+
+
+
Use dark mode
+ +
+
+