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