public static function updateInfo($ids, $data)
{
/*
* An array of the updated songs.
*
* @var array
*/
$updatedSongs = [];
$ids = (array) $ids;
// If we're updating only one song, take into account the title, lyrics, and track number.
$single = count($ids) === 1;
foreach ($ids as $id) {
if (!($song = self::with('album', 'album.artist')->find($id))) {
continue;
}
$updatedSongs[] = $song->updateSingle($single ? trim($data['title']) : $song->title, trim($data['albumName'] ?: $song->album->name), trim($data['artistName']) ?: $song->artist->name, $single ? trim($data['lyrics']) : $song->lyrics, $single ? (int) $data['track'] : $song->track, (int) $data['compilationState']);
}
// Our library may have been changed. Broadcast an event to tidy it up if need be.
if ($updatedSongs) {
event(new LibraryChanged());
}
return $updatedSongs;
}