Skip to content

Commit

Permalink
Add Custom Loading Gif
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinecraft committed Dec 6, 2023
1 parent 7361be7 commit 8343a4a
Show file tree
Hide file tree
Showing 157 changed files with 2,244 additions and 2,127 deletions.
10 changes: 10 additions & 0 deletions app/Http/Controllers/Admin/Settings/ThemeSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function update(Request $request, ThemeSettings $themeSettings)
'home_hero_bg_particles' => ['nullable', 'string', 'json'],
'home_hero_fg_image_light' => ['sometimes', 'nullable', 'mimes:jpg,jpeg,png,bmp,gif,svg,webp', 'max:1024'],
'home_hero_fg_image_dark' => ['sometimes', 'nullable', 'mimes:jpg,jpeg,png,bmp,gif,svg,webp', 'max:1024'],
'loading_gif' => ['sometimes', 'nullable', 'mimes:gif,svg', 'max:1024'],
]);

$themeSettings->color_mode = $request->color_mode;
Expand Down Expand Up @@ -101,6 +102,15 @@ public function update(Request $request, ThemeSettings $themeSettings)
$themeSettings->home_hero_fg_image_path_dark = Storage::url($path).'?hash='.\Str::random(8);
}

if ($request->hasFile('loading_gif')) {
$path = Storage::putFileAs(
'public', $request->file('loading_gif'), 'loading_gif.'.$request->file('loading_gif')->getClientOriginalExtension()
);
$themeSettings->loading_gif = Storage::url($path).'?hash='.\Str::random(8);
} elseif ($request->input('loading_gif') === null) {
$themeSettings->loading_gif = null;
}

$themeSettings->save();

return redirect()->back()
Expand Down
1 change: 1 addition & 0 deletions app/Settings/ThemeSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ThemeSettings extends Settings
public bool $show_fg_image_box_in_home_hero;
public bool $show_discord_box_in_home_hero;
public ?string $home_hero_bg_particles;
public ?string $loading_gif;

public static function group(): string
{
Expand Down
Loading

0 comments on commit 8343a4a

Please sign in to comment.