mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-25 19:56:05 +00:00
43 lines
1017 B
PHP
43 lines
1017 B
PHP
<?php
|
|
|
|
namespace BookStack\Http\Controllers;
|
|
|
|
use BookStack\Actions\TagRepo;
|
|
use Illuminate\Http\Request;
|
|
|
|
class TagController extends Controller
|
|
{
|
|
protected $tagRepo;
|
|
|
|
/**
|
|
* TagController constructor.
|
|
*/
|
|
public function __construct(TagRepo $tagRepo)
|
|
{
|
|
$this->tagRepo = $tagRepo;
|
|
}
|
|
|
|
/**
|
|
* Get tag name suggestions from a given search term.
|
|
*/
|
|
public function getNameSuggestions(Request $request)
|
|
{
|
|
$searchTerm = $request->get('search', null);
|
|
$suggestions = $this->tagRepo->getNameSuggestions($searchTerm);
|
|
|
|
return response()->json($suggestions);
|
|
}
|
|
|
|
/**
|
|
* Get tag value suggestions from a given search term.
|
|
*/
|
|
public function getValueSuggestions(Request $request)
|
|
{
|
|
$searchTerm = $request->get('search', null);
|
|
$tagName = $request->get('name', null);
|
|
$suggestions = $this->tagRepo->getValueSuggestions($searchTerm, $tagName);
|
|
|
|
return response()->json($suggestions);
|
|
}
|
|
}
|