fix: old vr solve music

This commit is contained in:
2026-05-21 09:25:39 +03:30
parent c980c2cd9d
commit 2c40ce1e46
2 changed files with 23 additions and 0 deletions
+19
View File
@@ -10,6 +10,25 @@
class MusicController extends Controller
{
// Add this new method to your MusicController
public function getAllMusic()
{
$userId = auth()->id();
$music = Music::with(['image', 'playlist'])
->where('type', 'public')
->orWhere(function($query) use ($userId) {
$query->where('type', 'private')
->where('user_id', $userId);
})
->orderBy('created_at', 'desc')
->get();
// Return as array directly (not wrapped in 'data' object)
// to match what your old Flutter app expects
return response()->json($music);
}
public function index()
{
$userId = auth()->id();