fix: add svg format

This commit is contained in:
2026-06-06 16:38:01 +03:30
parent 9080cf866e
commit 835cba22ed
7 changed files with 17 additions and 14 deletions
@@ -15,7 +15,7 @@ protected function fileFields(): array
{
return [
'sound' => ['column' => 'sound_path', 'folder' => 'background-sounds/sounds', 'rules' => 'nullable|file|extensions:mp3,wav,ogg,flac,aac,m4a,opus,mpga,wma|max:102400'],
'image' => ['column' => 'image_path', 'folder' => 'background-sounds/images', 'rules' => 'nullable|image|max:8192'],
'image' => ['column' => 'image_path', 'folder' => 'background-sounds/images', 'rules' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192'],
];
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ protected function fileFields(): array
{
return [
'sound' => ['column' => 'sound_path', 'folder' => 'bells/sounds', 'rules' => 'nullable|file|extensions:mp3,wav,ogg,flac,aac,m4a,opus,mpga,wma|max:51200'],
'image' => ['column' => 'image_path', 'folder' => 'bells/images', 'rules' => 'nullable|image|max:8192'],
'image' => ['column' => 'image_path', 'folder' => 'bells/images', 'rules' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192'],
];
}
}
+2 -2
View File
@@ -29,7 +29,7 @@ public function store(Request $request)
$data = $request->validate([
'name' => 'required|string|max:255|unique:categories,name',
'description' => 'nullable|string',
'icon' => 'nullable|image|max:8192',
'icon' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
]);
$category = Category::create([
@@ -60,7 +60,7 @@ public function update(Request $request, $id)
$data = $request->validate([
'name' => 'sometimes|string|max:255|unique:categories,name,' . $category->id,
'description' => 'nullable|string',
'icon' => 'nullable|image|max:8192',
'icon' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
]);
if (array_key_exists('name', $data)) {
+7 -4
View File
@@ -4,21 +4,24 @@
namespace App\Http\Controllers;
use App\Models\Image;
use App\Traits\StoresUploads;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class ImageController extends Controller
{
use StoresUploads;
public function store(Request $request)
{
$data = $request->validate([
'image' => 'required|image|max:2048',
'image' => 'required|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
'title' => 'nullable|string|max:255',
'description' => 'nullable|string|max:500',
'type' => 'nullable|in:public,private',
]);
$path = $request->file('image')->store('images', 'public');
$path = $this->storeUpload($request->file('image'), 'images');
$image = Image::create([
'user_id' => auth()->id(),
@@ -83,7 +86,7 @@ public function update(Request $request, $id)
'title' => 'nullable|string|max:255',
'description' => 'nullable|string|max:500',
'type' => 'nullable|in:public,private',
'image' => 'nullable|image|max:2048',
'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
]);
if ($request->hasFile('image')) {
@@ -91,7 +94,7 @@ public function update(Request $request, $id)
Storage::disk('public')->delete($image->path);
// store new one
$path = $request->file('image')->store('images', 'public');
$path = $this->storeUpload($request->file('image'), 'images');
$image->path = $path;
}
+2 -2
View File
@@ -29,7 +29,7 @@ public function store(Request $request)
'subcategory_ids' => 'nullable|array',
'subcategory_ids.*' => 'integer|exists:sub_categories,id',
'image_id' => 'nullable|exists:images,id',
'image' => 'nullable|image|max:8192',
'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
'duration' => 'nullable|integer',
'is_premium' => 'nullable|boolean',
'file' => 'nullable|file|extensions:mp3,wav,ogg,flac,aac,m4a,opus,mpga,wma,mp4,mov,m4v,webm,mkv,avi,3gp|max:512000',
@@ -481,7 +481,7 @@ public function update(Request $request, $id)
'subcategory_ids.*' => 'integer|exists:sub_categories,id',
'is_premium' => 'nullable|boolean',
'image_id' => 'nullable|exists:images,id',
'image' => 'nullable|image|max:8192',
'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
'duration' => 'nullable|integer',
'file' => 'nullable|file|extensions:mp3,wav,ogg,flac,aac,m4a,opus,mpga,wma,mp4,mov,m4v,webm,mkv,avi,3gp|max:512000',
'external_url' => 'nullable|string',
+2 -2
View File
@@ -138,7 +138,7 @@ public function store(Request $request)
'file' => 'required|file|extensions:mp3,wav,ogg,flac,aac,m4a,opus,mpga,wma|max:20971520',
'type' => 'nullable|in:public,private',
'image_id' => 'nullable|exists:images,id',
'image' => 'nullable|image|max:8192',
'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
'playlist_id' => 'nullable|exists:music_playlists,id', // single (backward compatible)
'playlist_ids' => 'nullable|array', // multiple
'playlist_ids.*' => 'integer|exists:music_playlists,id',
@@ -241,7 +241,7 @@ public function update(Request $request, $id)
'type' => 'nullable|in:public,private',
'file' => 'nullable|file|extensions:mp3,wav,ogg,flac,aac,m4a,opus,mpga,wma|max:20971520',
'image_id' => 'nullable|exists:images,id',
'image' => 'nullable|image|max:8192',
'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
'duration' => 'nullable|integer|min:1',
'is_active' => 'nullable|boolean',
]);
+2 -2
View File
@@ -76,7 +76,7 @@ public function store(Request $request)
'name' => 'required|string|max:255',
'order' => 'nullable|integer',
'is_active' => 'nullable|boolean',
'image' => 'nullable|image|max:8192',
'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
'video' => 'nullable|mimes:mp4,mov,webm|max:512000',
'sound' => 'nullable|mimes:mp3,wav,ogg,flac|max:51200',
]);
@@ -105,7 +105,7 @@ public function update(Request $request, $id)
'name' => 'sometimes|string|max:255',
'order' => 'nullable|integer',
'is_active' => 'nullable|boolean',
'image' => 'nullable|image|max:8192',
'image' => 'nullable|file|extensions:jpg,jpeg,png,gif,webp,bmp,svg|max:8192',
'video' => 'nullable|mimes:mp4,mov,webm|max:512000',
'sound' => 'nullable|mimes:mp3,wav,ogg,flac|max:51200',
]);