searchService = $searchService; } public function index(Request $request) { if (!$request->get('q')) { throw new InvalidArgumentException('A search query is required.'); } return [ 'songs' => $this->searchService->searchSongs($request->get('q')), ]; } }