2016-07-14 08:47:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
|
2017-12-09 18:34:27 +00:00
|
|
|
use App\Http\Requests\API\YouTubeSearchRequest;
|
2016-07-14 08:47:50 +00:00
|
|
|
use App\Models\Song;
|
2017-06-04 01:30:45 +00:00
|
|
|
use Illuminate\Http\JsonResponse;
|
2016-07-14 08:47:50 +00:00
|
|
|
|
|
|
|
class YouTubeController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Search for YouTube videos related to a song (using its title and artist name).
|
|
|
|
*
|
2017-12-09 18:34:27 +00:00
|
|
|
* @param YouTubeSearchRequest $request
|
|
|
|
* @param Song $song
|
2016-07-14 08:47:50 +00:00
|
|
|
*
|
2017-06-04 01:30:45 +00:00
|
|
|
* @return JsonResponse
|
2016-07-14 08:47:50 +00:00
|
|
|
*/
|
2017-12-09 18:34:27 +00:00
|
|
|
public function searchVideosRelatedToSong(YouTubeSearchRequest $request, Song $song)
|
2016-07-14 08:47:50 +00:00
|
|
|
{
|
2016-09-26 06:49:30 +00:00
|
|
|
return response()->json($song->getRelatedYouTubeVideos($request->pageToken));
|
2016-07-14 08:47:50 +00:00
|
|
|
}
|
|
|
|
}
|