koel/app/Http/Controllers/API/YouTubeController.php
2016-09-26 14:49:30 +08:00

23 lines
549 B
PHP

<?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)
{
return response()->json($song->getRelatedYouTubeVideos($request->pageToken));
}
}