2022-06-10 10:47:46 +00:00
|
|
|
<?php
|
|
|
|
|
2023-06-05 21:46:41 +00:00
|
|
|
namespace App\Http\Controllers\API;
|
2022-06-10 10:47:46 +00:00
|
|
|
|
2022-07-29 06:47:10 +00:00
|
|
|
use App\Http\Controllers\Controller;
|
2023-06-05 21:46:41 +00:00
|
|
|
use App\Http\Requests\API\SearchRequest;
|
2022-06-10 10:47:46 +00:00
|
|
|
use App\Http\Resources\ExcerptSearchResource;
|
|
|
|
use App\Models\User;
|
2023-06-05 21:46:41 +00:00
|
|
|
use App\Services\SearchService;
|
2022-06-10 10:47:46 +00:00
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
|
|
|
|
|
|
class ExcerptSearchController extends Controller
|
|
|
|
{
|
|
|
|
/** @param User $user */
|
|
|
|
public function __invoke(SearchRequest $request, SearchService $searchService, Authenticatable $user)
|
|
|
|
{
|
|
|
|
return ExcerptSearchResource::make($searchService->excerptSearch($request->q, $user));
|
|
|
|
}
|
|
|
|
}
|