From 2a0bd8fcd81b7ce632caa23ef64ff9f1c8b65bda Mon Sep 17 00:00:00 2001 From: Matthias Gutjahr Date: Sun, 20 Dec 2015 19:09:34 +0100 Subject: [PATCH] Add cast to convert Song.length to float --- app/Models/Song.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Models/Song.php b/app/Models/Song.php index 39f22c43..61bc8ba7 100644 --- a/app/Models/Song.php +++ b/app/Models/Song.php @@ -20,6 +20,13 @@ class Song extends Model */ protected $hidden = ['lyrics', 'created_at', 'updated_at', 'path', 'mtime']; + /** + * @var array + */ + protected $casts = [ + 'length' => 'float' + ]; + public function album() { return $this->belongsTo(Album::class);