### app binding : xe.tag 로 바인딩 되어 있음
Tag Facade 로 접근이 가능
### 등록 및 반환
php
등록
각각의 인스턴스를 구분하기위해 대상의 인스턴스 아이디가 전달되어야 합니다.
Tag::set('instanceId', 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', ['word1', 'word2', 'word3']);
반환
$tags = Tag::get('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
### 자동 완성
단어를 쉽게 완성할 수 있도록 기존에 등록된 단어중 입력중인 문자와 유사한 단어들을
검색하여 반환해줍니다.
php
$tags = Tag::autoCompletion('ap');
app, application, apm, append, apple ...
public function testCount() { list($repo, $decomposer) = $this->getMocks(); $instance = new TagHandler($repo, $decomposer); $repo->shouldReceive('count')->once()->with('freeboard', 'pop', null, null)->andReturn(3); $count = $instance->count('freeboard', 'pop', null, null); $this->assertEquals(3, $count); }
/** * 해시태그 suggestion 리스트 * * @param Request $request * @param TagHandler $tag * @return mixed */ public function hashTag(Request $request, TagHandler $tag) { $tags = $tag->similar($request->get('string')); $suggestions = []; foreach ($tags as $tag) { $suggestions[] = ['id' => $tag->id, 'word' => $tag->word]; } return XePresenter::makeApi($suggestions); }
/** * set tags * * @param Board $board board model * @param array $args arguments * @return void */ protected function setTags(Board $board, array $args) { if (empty($args['_hashTags']) === false) { $this->tag->set($board->getKey(), $args['_hashTags']); } }