diff --git a/app/Http/Controllers/Admin/SettingsController.php b/app/Http/Controllers/Admin/SettingsController.php index fff3dc1b..375c5c0c 100644 --- a/app/Http/Controllers/Admin/SettingsController.php +++ b/app/Http/Controllers/Admin/SettingsController.php @@ -8,7 +8,6 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Http\Request; use Illuminate\Http\Response; -use Illuminate\Support\Facades\Storage; class SettingsController extends Controller { @@ -22,25 +21,20 @@ class SettingsController extends Controller return view('admin.settings.index'); } - public function updateIcons(Request $request){ - + public function updateIcons(Request $request) + { $request->validate([ - 'favicon' => 'required', - 'icon' => 'required', + 'icon' => 'nullable|max:10000|mimes:jpg,png,jpeg', + 'favicon' => 'nullable|max:10000|mimes:ico', ]); - //store favicon - $favicon = $request->input('favicon'); - $favicon = json_decode($favicon); - $favicon = explode(",",$favicon->output->image)[1]; - Storage::disk('public')->put('favicon.ico' , base64_decode($favicon)); + if ($request->hasFile('icon')) { + $request->file('icon')->storeAs('public', 'icon.png'); + } - //store dashboard icon - $icon = $request->input('icon'); - $icon = json_decode($icon); - $icon = explode(",",$icon->output->image)[1]; - - Storage::disk('public')->put('icon.png' , base64_decode($icon)); + if ($request->hasFile('favicon')) { + $request->file('favicon')->storeAs('public', 'favicon.ico'); + } return redirect()->route('admin.settings.index')->with('success', 'Icons updated!'); } diff --git a/resources/views/admin/settings/index.blade.php b/resources/views/admin/settings/index.blade.php index dcee6c7a..55a0150f 100644 --- a/resources/views/admin/settings/index.blade.php +++ b/resources/views/admin/settings/index.blade.php @@ -45,41 +45,38 @@
-
+ @csrf @method('PATCH') -
-
-
Dashboard Icon
-
-
- - icon +
+
+
+
+ +
+ @error('icon') + + {{$message}} + + @enderror
-
- - -
-
Favicon
-
-
- - favicon +
+
+ +
+ @error('favicon') + + {{$message}} + + @enderror
@@ -87,7 +84,8 @@ -

Images and Icons may be cached, use CNTRL + F5(google chrome hotkey) to reload without cache to see your changes appear :)

+

Images and Icons may be cached, use CNTRL + F5(google + chrome hotkey) to reload without cache to see your changes appear :)

@@ -103,7 +101,15 @@ - + @endsection