话题详情

This commit is contained in:
fthvgb1 2018-06-10 19:32:12 +08:00
parent c63c71fc39
commit 22501cc89a
2 changed files with 7 additions and 0 deletions

View File

@ -49,6 +49,11 @@ class TopicsController extends Controller
return $this->response->paginator($topics, new TopicTransformer()); return $this->response->paginator($topics, new TopicTransformer());
} }
public function show(Topic $topic)
{
return $this->response->item($topic, new TopicTransformer());
}
/** /**
* @param Topic $topic * @param Topic $topic
* @return \Dingo\Api\Http\Response * @return \Dingo\Api\Http\Response

View File

@ -55,6 +55,8 @@ $api->version('v1', [
$api->get('topics', 'TopicsController@index')->name('api.topics.index'); $api->get('topics', 'TopicsController@index')->name('api.topics.index');
//某用户的话题列表 //某用户的话题列表
$api->get('users/{user}/topics', 'TopicsController@userIndex')->name('api.users.topics.index'); $api->get('users/{user}/topics', 'TopicsController@userIndex')->name('api.users.topics.index');
//话题详情
$api->get('topics/{topic}', 'TopicsController@show')->name('api.topics.show');
}); });
// 需要 token 验证的接口 // 需要 token 验证的接口