![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mcoil.corals.io/vendor/binarytorch/larecipe/src/Http/Controllers/ |
<?php namespace BinaryTorch\LaRecipe\Http\Controllers; use BinaryTorch\LaRecipe\DocumentationRepository; class SearchController extends Controller { /** * @var DocumentationRepository */ protected $documentationRepository; /** * SearchController constructor. * @param DocumentationRepository $documentationRepository */ public function __construct(DocumentationRepository $documentationRepository) { $this->documentationRepository = $documentationRepository; if (config('larecipe.settings.auth')) { $this->middleware(['auth']); }else{ if(config('larecipe.settings.middleware')){ $this->middleware(config('larecipe.settings.middleware')); } } } /** * Get the index of a given version. * * @param $version * @return \Illuminate\Http\JsonResponse */ public function __invoke($version) { $this->authorizeAccessSearch($version); return response()->json( $this->documentationRepository->search($version) ); } /** * @param $version */ protected function authorizeAccessSearch($version) { abort_if( $this->documentationRepository->isNotPublishedVersion($version) || config('larecipe.search.default') != 'internal' || ! config('larecipe.search.enabled') , 403); } }