added media to setting

v1.0.0
A1Gard 7 months ago
parent 0abc96ce14
commit ef29ae0aea

@ -97,12 +97,13 @@ class SettingController extends Controller
$files = $request->allFiles();
if (isset($files['pic'])) {
foreach ($files['pic'] as $index => $file) {
// $name = time() . '.' . $file->getClientOriginalExtension();
// Setting::where('key',$key)->update(['value' => $name]);
// $request->file($index)->storeAs('public/setting', $name);
if ($file->extension() == 'mp4' || $file->extension() == 'mp3'){
$file->move(public_path('/assets/file/'), str_replace('_','.',$index) );//store('/images/'.,['disk' => 'public']);
}else{
$file->move(public_path('/images/'), str_replace('_','.',$index) );//store('/images/'.,['disk' => 'public']);
}
}
}
return redirect()->back()->with(['message' => __('Setting of website updated')]);
}

@ -284,6 +284,7 @@
"Main product category": "دسته اصلی محصول",
"Manage": "مدیریت",
"Max click": "حداکثر تعداد کلیک",
"Media": "رسانه",
"Menu": "فهرست\/منو",
"Menus": "فهرست‌ها",
"Menus list": "فهرست منوها",

@ -220,6 +220,7 @@
"Main product category": "«Основная категория товаров»",
"Manage": "Управлять",
"Max click": "«Макс клик»",
"Media": "",
"Menu": "",
"Menus": "«Меню»",
"Menus list": "«Список меню»",

@ -84,10 +84,26 @@
</select>
@break
@case('image')
<img src="{{asset('images/'.str_replace('_','.',$set->key))}}?{{time()}}"
class="img-fluid" style="max-height: 150px;max-width: 45%" alt="cover">
@if(pathinfo(str_replace('_','.',$set->key), PATHINFO_EXTENSION) == 'mp4')
<video controls
src="{{asset('assets/file/'.str_replace('_','.',$set->key))}}?{{time()}}"
class="img-fluid"
style="max-height: 150px;max-width: 45%"></video>
<br>
@elseif(pathinfo(str_replace('_','.',$set->key), PATHINFO_EXTENSION) == 'mp3')
<audio controls
src="{{asset('assets/file/'.str_replace('_','.',$set->key))}}?{{time()}}"
class="img-fluid"
style="max-height: 150px;max-width: 45%"></audio>
<br>
@else
<img
src="{{asset('images/'.str_replace('_','.',$set->key))}}?{{time()}}"
class="img-fluid" style="max-height: 150px;max-width: 45%"
alt="cover">
@endif
<input type="file" name="pic[{{$set->key}}]" id="{{$set->key}}"
accept="image/*"
accept=".{{pathinfo(str_replace('_','.',$set->key), PATHINFO_EXTENSION)}}"
class="form-control-file"/>
@break
@default
@ -152,7 +168,7 @@
<option value="checkbox"
@if (old('type') == 'checkbox' ) selected @endif >{{__("Checkbox")}} </option>
<option value="image"
@if (old('type') == 'image' ) selected @endif >{{__("Image")}} </option>
@if (old('type') == 'image' ) selected @endif >{{__("Media")}} </option>
</select>
</div>
@ -189,7 +205,7 @@
<script>
try {
document.querySelector('#price').classList.add('currency');
} catch(e) {
} catch (e) {
// console.log(e.message);
}

Loading…
Cancel
Save