From ef29ae0aeaf3bc18ff406985911e95f6e99517bb Mon Sep 17 00:00:00 2001 From: A1Gard Date: Thu, 11 Apr 2024 00:00:59 +0330 Subject: [PATCH] added media to setting --- .../Controllers/Admin/SettingController.php | 9 ++++--- resources/lang/fa.json | 3 ++- resources/lang/ru.json | 1 + resources/views/admin/setting.blade.php | 26 +++++++++++++++---- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/Admin/SettingController.php b/app/Http/Controllers/Admin/SettingController.php index 1673fbf..aa9155a 100755 --- a/app/Http/Controllers/Admin/SettingController.php +++ b/app/Http/Controllers/Admin/SettingController.php @@ -97,10 +97,11 @@ public function update(Request $request) { $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); - $file->move(public_path('/images/'), str_replace('_','.',$index) );//store('/images/'.,['disk' => 'public']); + 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')]); diff --git a/resources/lang/fa.json b/resources/lang/fa.json index c55a6e7..d032a6d 100755 --- a/resources/lang/fa.json +++ b/resources/lang/fa.json @@ -284,6 +284,7 @@ "Main product category": "دسته اصلی محصول", "Manage": "مدیریت", "Max click": "حداکثر تعداد کلیک", + "Media": "رسانه", "Menu": "فهرست\/منو", "Menus": "فهرست‌ها", "Menus list": "فهرست منوها", @@ -632,4 +633,4 @@ "user": "کاربر", "weight": "وزن", "yesterday": "دیروز" -} \ No newline at end of file +} diff --git a/resources/lang/ru.json b/resources/lang/ru.json index e2cbfbf..16dbf06 100644 --- a/resources/lang/ru.json +++ b/resources/lang/ru.json @@ -220,6 +220,7 @@ "Main product category": "«Основная категория товаров»", "Manage": "Управлять", "Max click": "«Макс клик»", + "Media": "", "Menu": "", "Menus": "«Меню»", "Menus list": "«Список меню»", diff --git a/resources/views/admin/setting.blade.php b/resources/views/admin/setting.blade.php index 49aef0f..dda70c9 100755 --- a/resources/views/admin/setting.blade.php +++ b/resources/views/admin/setting.blade.php @@ -84,10 +84,26 @@ class="ckeditorx form-control" @break @case('image') - cover + @if(pathinfo(str_replace('_','.',$set->key), PATHINFO_EXTENSION) == 'mp4') + +
+ @elseif(pathinfo(str_replace('_','.',$set->key), PATHINFO_EXTENSION) == 'mp3') + +
+ @else + cover + @endif @break @default @@ -152,7 +168,7 @@ class="form-control @error('section') is-invalid @enderror" + @if (old('type') == 'image' ) selected @endif >{{__("Media")}} @@ -189,7 +205,7 @@ class="form-control @error('section') is-invalid @enderror"