added color to setting

pull/44/head
A1Gard 4 months ago
parent e280b8deb8
commit 801de6ae1d

@ -548,8 +548,10 @@ function validateSettingRequest($setting, $newValue)
switch ($setting->key) {
case 'optimize':
if ($newValue != 'jpg' || $newValue != 'webp') {
if ($newValue != 'jpg' && $newValue != 'webp') {
return 'webp';
}else{
return $newValue;
}
case 'gallery_thumb':
case 'post_thumb':

@ -13,5 +13,5 @@ class Setting extends Model
public $translatable = ['value'];
public static $settingTypes = ['TEXT', 'LONGTEXT', 'CODE', 'EDITOR',
'CATEGORY', 'GROUP', 'CHECKBOX', 'FILE'];
'CATEGORY', 'GROUP', 'CHECKBOX', 'FILE','COLOR'];
}

@ -62,7 +62,7 @@
<select name="type" id="type"
class="form-control @error('type') is-invalid @enderror">
@foreach(\App\Models\Setting::$settingTypes as $type)
<option value="text"
<option value="{{$type}}"
@if (old('type') == $type ) selected @endif >{{__($type)}} </option>
@endforeach

@ -56,6 +56,12 @@
xvalue='{{old($setting->key,$setting->value??null)}}'
:close-on-Select="true"></searchable-select>
@break
@case('COLOR')
<br>
<input type="color" id="{{$setting->key}}"
name="{{$setting->key}}" class="form-control-color w-100"
value="{{old($setting->key, $setting->value)}}" >
@break
@case('FILE')
<div class="row">
@php($ext = strtolower(pathinfo(str_replace('_','.',$setting->key), PATHINFO_EXTENSION)))
@ -87,9 +93,9 @@
@default
@if($setting->key == 'optimize')
<select class="form-control" name="{{$setting->key}}" id="{{$setting->key}}">
<option value="1"
<option value="jpg"
@if (old($setting->key, $setting->value??'webp') == 'jpg' ) selected @endif >{{__("jpg")}} </option>
<option value="0"
<option value="webp"
@if (old($setting->key, $setting->value??'webp') == 'webp' ) selected @endif >{{__("webp")}} </option>
</select>
@else

Loading…
Cancel
Save