diff --git a/app/Http/Controllers/MediaController.php b/app/Http/Controllers/MediaController.php index 612f7f7..f796e4a 100644 --- a/app/Http/Controllers/MediaController.php +++ b/app/Http/Controllers/MediaController.php @@ -23,7 +23,7 @@ public function store(Request $request) 'image_id' => 'nullable|exists:images,id', 'duration' => 'nullable|integer', - 'file' => 'nullable|mimes:mp3,wav,mp4,mov|max:50480', + 'file' => 'nullable|mimes:mp3,wav,mp4,mov|max:512000', 'external_url' => 'nullable|string', 'visibility' => 'nullable|in:public,private', @@ -71,8 +71,6 @@ public function store(Request $request) 'media' => $media->load(['image', 'category' , 'tags']), ]); } - - // GET all visible media public function index(Request $request) { $query = Media::with(['image', 'category', 'myNote', 'tags']) @@ -80,18 +78,9 @@ public function index(Request $request) $q->where('visibility', 'public') ->orWhere('user_id', auth()->id()); }); - - // ---------------------------- - // Filter by category_id - // ---------------------------- if ($request->filled('category')) { $query->where('category_id', $request->category); } - - // ---------------------------- - // Filter by tags (multiple) - // ?tags=relax,sleep - // ---------------------------- if ($request->filled('tags')) { $tags = explode(',', $request->tags); @@ -99,12 +88,6 @@ public function index(Request $request) $q->whereIn('name', $tags); }); } - - // ---------------------------- - // Global search - // ?search=sleep OR ?search=rel - // Search in: title, caption, category name, tags - // ---------------------------- if ($request->filled('search')) { $search = $request->search; @@ -125,10 +108,6 @@ public function index(Request $request) }); }); } - - // ---------------------------- - // Final result - // ---------------------------- return response()->json( $query->orderBy('created_at', 'desc')->get() ); @@ -163,7 +142,7 @@ public function update(Request $request, $id) 'image_id' => 'nullable|exists:images,id', 'duration' => 'nullable|integer', - 'file' => 'nullable|mimes:mp3,wav,mp4,mov|max:50480', + 'file' => 'nullable|mimes:mp3,wav,mp4,mov|max:512000', 'external_url' => 'nullable|string', 'visibility' => 'nullable|in:public,private', 'tags' => 'nullable|array',