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
@@ -168,12 +168,17 @@ class SyncSpotifyMusicProductions extends Command
$slug = Str::slug($title);
$bySlug = MusicProduction::where('slug', '=', $slug, 'and')->first();
$bySlug = MusicProduction::query()
->where('slug', $slug)
->first();
if ($bySlug) {
return $bySlug;
}
return MusicProduction::whereRaw('LOWER(title) = ?', [Str::lower($title)], 'and')->first();
return MusicProduction::query()
->whereRaw('LOWER(title) = ?', [Str::lower($title)], 'and')
->first();
}
protected function parseReleaseDate(?string $date, string $precision = 'day'): ?Carbon