mirror of
https://github.com/koel/koel
synced 2024-11-28 15:00:42 +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 = [
|
protected $casts = [
|
||||||
'length' => 'float',
|
'length' => 'float',
|
||||||
'mtime' => 'int',
|
'mtime' => 'int',
|
||||||
|
'track' => 'int',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,12 +134,11 @@ class Song extends Model
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're updating only one song, take into account the title and lyrics
|
// If we're updating only one song, take into account the title, lyrics, and track number.
|
||||||
// and track number.
|
|
||||||
if (count($ids) === 1) {
|
if (count($ids) === 1) {
|
||||||
$song->title = trim($data['title']) ?: $song->title;
|
$song->title = trim($data['title']) ?: $song->title;
|
||||||
$song->lyrics = trim($data['lyrics']);
|
$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.
|
// If "newArtist" is provided, we'll see if such an artist name is found in our database.
|
||||||
|
|
Loading…
Reference in a new issue