mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Added some logic around deleting images
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
5b8f6910fb
commit
2f3be267b3
|
@ -416,44 +416,64 @@ class SettingsController extends Controller
|
|||
// Because public demos make people act like dicks
|
||||
|
||||
if (!config('app.lock_passwords')) {
|
||||
|
||||
if ($request->has('site_name')) {
|
||||
$request->validate(['site_name' => 'required']);
|
||||
$setting->site_name = $request->input('site_name');
|
||||
}
|
||||
|
||||
$setting->site_name = $request->input('site_name', 'Snipe-IT');
|
||||
$setting->custom_css = $request->input('custom_css');
|
||||
|
||||
// Logo upload
|
||||
$setting = $request->handleImages($setting, 600, 'logo', '', 'logo');
|
||||
if ('1' == $request->input('clear_logo')) {
|
||||
|
||||
if ($request->input('clear_logo') == '1') {
|
||||
|
||||
if (($setting->logo) && (Storage::exists($setting->logo))) {
|
||||
Storage::disk('public')->delete($setting->logo);
|
||||
}
|
||||
$setting->logo = null;
|
||||
$setting->brand = 1;
|
||||
}
|
||||
|
||||
// Email logo upload
|
||||
$setting = $request->handleImages($setting, 600, 'email_logo', '', 'email_logo');
|
||||
if ('1' == $request->input('clear_email_logo')) {
|
||||
if ($request->input('clear_email_logo') == '1') {
|
||||
|
||||
if (($setting->email_logo) && (Storage::exists($setting->email_logo))) {
|
||||
Storage::disk('public')->delete($setting->email_logo);
|
||||
}
|
||||
$setting->email_logo = null;
|
||||
// If they are uploading an image, validate it and upload it
|
||||
}
|
||||
|
||||
// Label logo upload
|
||||
$setting = $request->handleImages($setting, 600, 'label_logo', '', 'label_logo');
|
||||
if ('1' == $request->input('clear_label_logo')) {
|
||||
if ($request->input('clear_label_logo') == '1') {
|
||||
|
||||
if (($setting->label_logo) && (Storage::exists($setting->label_logo))) {
|
||||
Storage::disk('public')->delete($setting->label_logo);
|
||||
}
|
||||
$setting->label_logo = null;
|
||||
}
|
||||
|
||||
// Favicon upload
|
||||
$setting = $request->handleImages($setting, 100, 'favicon', '', 'favicon');
|
||||
if ('1' == $request->input('clear_favicon')) {
|
||||
|
||||
if (($setting->favicon) && (Storage::exists($setting->favicon))) {
|
||||
Storage::disk('public')->delete($setting->favicon);
|
||||
}
|
||||
$setting->favicon = null;
|
||||
}
|
||||
|
||||
// Default avatar upload
|
||||
$setting = $request->handleImages($setting, 500, 'default_avatar', 'avatars', 'default_avatar');
|
||||
if ($request->input('clear_default_avatar') == '1') {
|
||||
|
||||
if (($setting->default_avatar) && (Storage::exists('avatars/'.$setting->default_avatar))) {
|
||||
Storage::disk('public')->delete('avatars/'.$setting->default_avatar);
|
||||
}
|
||||
$setting->default_avatar = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue