refactor: optimize query usage in SyncSpotifyMusicProductions and SyncYoutubeReleases commands, enhance MusicProductionController by removing unused header logic, and update view structure for improved maintainability

This commit is contained in:
Ümit Tunç
2026-05-20 23:10:05 +03:00
parent ad4f04b005
commit 187f8c3812
6 changed files with 164 additions and 61 deletions
+5 -3
View File
@@ -171,15 +171,17 @@ class SyncYoutubeReleases extends Command
$slug = Str::slug($title);
$bySlug = MusicProduction::whereNull('youtube_video_id')
->where('slug', '=', $slug, 'and')
$bySlug = MusicProduction::query()
->whereNull('youtube_video_id', 'and', false)
->where('slug', '=', $slug)
->first();
if ($bySlug) {
return $bySlug;
}
return MusicProduction::whereNull('youtube_video_id')
return MusicProduction::query()
->whereNull('youtube_video_id', 'and', false)
->whereRaw('LOWER(title) = ?', [Str::lower($title)], 'and')
->first();
}