2016-05-30 05:50:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
2017-04-29 06:06:36 +00:00
|
|
|
use Illuminate\Http\Request;
|
2016-05-30 05:50:59 +00:00
|
|
|
use App\Models\Song;
|
|
|
|
|
|
|
|
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
|
|
|
*
|
|
|
|
* @return \Illuminate\Http\JsonResponse
|
|
|
|
*/
|
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
|
|
|
}
|
|
|
|
}
|