2016-05-30 05:50:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
|
|
|
use App\Models\Song;
|
2017-06-04 01:30:45 +00:00
|
|
|
use Illuminate\Http\JsonResponse;
|
2017-05-01 17:49:44 +00:00
|
|
|
use Illuminate\Http\Request;
|
2016-05-30 05:50:59 +00:00
|
|
|
|
|
|
|
class ScrobbleController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create a Last.fm scrobble entry for a song.
|
|
|
|
*
|
2017-04-29 02:38:17 +00:00
|
|
|
* @param Request $request
|
|
|
|
* @param Song $song
|
|
|
|
* @param string $timestamp The UNIX timestamp when the song started playing.
|
2016-05-30 05:50:59 +00:00
|
|
|
*
|
2017-06-04 01:30:45 +00:00
|
|
|
* @return JsonResponse
|
2016-05-30 05:50:59 +00:00
|
|
|
*/
|
2017-04-29 02:38:17 +00:00
|
|
|
public function store(Request $request, Song $song, $timestamp)
|
2016-05-30 05:50:59 +00:00
|
|
|
{
|
2017-04-29 02:38:17 +00:00
|
|
|
return response()->json($song->scrobble($request->user(), $timestamp));
|
2016-05-30 05:50:59 +00:00
|
|
|
}
|
|
|
|
}
|