fix: old vr solve music
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user