3 namespace BookStack\Http\Controllers;
5 use BookStack\Actions\TagRepo;
6 use Illuminate\Http\Request;
8 class TagController extends Controller
13 * TagController constructor.
15 public function __construct(TagRepo $tagRepo)
17 $this->tagRepo = $tagRepo;
21 * Get tag name suggestions from a given search term.
23 public function getNameSuggestions(Request $request)
25 $searchTerm = $request->get('search', null);
26 $suggestions = $this->tagRepo->getNameSuggestions($searchTerm);
28 return response()->json($suggestions);
32 * Get tag value suggestions from a given search term.
34 public function getValueSuggestions(Request $request)
36 $searchTerm = $request->get('search', null);
37 $tagName = $request->get('name', null);
38 $suggestions = $this->tagRepo->getValueSuggestions($searchTerm, $tagName);
40 return response()->json($suggestions);