Fix AWS S3 related issues. (#757)

* Avoid an error from MySQL, "Column cannot be null".

Similar to this issue: https://stackoverflow.com/questions/43860634/laravel-5-4-upgrade-integrity-constraint-violation-column-cannot-be-null

* Clears the media cache after storing a new song.
This commit is contained in:
N.Yanbe 2018-06-16 18:29:41 +09:00 committed by Phan An
parent 1475ebaddf
commit 064d6f8615

View file

@ -40,11 +40,12 @@ class SongController extends Controller
'album_id' => $album->id,
'artist_id' => $artist->id,
'title' => trim(array_get($tags, 'title', '')),
'length' => array_get($tags, 'duration', 0),
'length' => array_get($tags, 'duration', 0) ?: 0,
'track' => (int) array_get($tags, 'track'),
'lyrics' => array_get($tags, 'lyrics', ''),
'lyrics' => array_get($tags, 'lyrics', '') ?: '',
'mtime' => time(),
]);
event(new LibraryChanged());
return response()->json($song);
}