mirror of
https://github.com/koel/koel
synced 2024-11-24 21:23:06 +00:00
Cast track number as int
This commit is contained in:
parent
f4e5a4501d
commit
8142782766
1 changed files with 3 additions and 3 deletions
|
@ -30,6 +30,7 @@ class Song extends Model
|
|||
protected $casts = [
|
||||
'length' => 'float',
|
||||
'mtime' => 'int',
|
||||
'track' => 'int',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -133,12 +134,11 @@ class Song extends Model
|
|||
continue;
|
||||
}
|
||||
|
||||
// If we're updating only one song, take into account the title and lyrics
|
||||
// and track number.
|
||||
// If we're updating only one song, take into account the title, lyrics, and track number.
|
||||
if (count($ids) === 1) {
|
||||
$song->title = trim($data['title']) ?: $song->title;
|
||||
$song->lyrics = trim($data['lyrics']);
|
||||
$song->track = trim($data['track']);
|
||||
$song->track = (int) trim($data['track']);
|
||||
}
|
||||
|
||||
// If "newArtist" is provided, we'll see if such an artist name is found in our database.
|
||||
|
|
Loading…
Reference in a new issue