authorize('upload', User::class); try { $song = $songRepository->getOne($uploadService->handleUploadedFile($request->file)->id); event(new LibraryChanged()); return response()->json([ 'song' => SongResource::make($song), 'album' => AlbumResource::make($albumRepository->getOne($song->album_id)), ]); } catch (MediaPathNotSetException $e) { abort(Response::HTTP_FORBIDDEN, $e->getMessage()); } catch (SongUploadFailedException $e) { abort(Response::HTTP_BAD_REQUEST, $e->getMessage()); } } }