mirror of
https://github.com/koel/koel
synced 2025-01-18 23:44:03 +00:00
28 lines
608 B
PHP
28 lines
608 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API\Search;
|
|
|
|
use App\Http\Controllers\API\Controller;
|
|
use App\Services\SearchService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ExcerptSearchController extends Controller
|
|
{
|
|
private $searchService;
|
|
|
|
public function __construct(SearchService $searchService)
|
|
{
|
|
$this->searchService = $searchService;
|
|
}
|
|
|
|
public function index(Request $request)
|
|
{
|
|
if (!$request->get('q')) {
|
|
return ['results' => []];
|
|
}
|
|
|
|
return [
|
|
'results' => $this->searchService->excerptSearch($request->get('q')),
|
|
];
|
|
}
|
|
}
|