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-08-03 10:42:11 +00:00
|
|
|
return response()->json(YouTube::searchVideosRelatedToSong($song, $request->pageToken));
|
2016-07-14 08:47:50 +00:00
|
|
|
}
|
|
|
|
}
|