public function index(Request $request) { if ($request->get('unflagged')) { return $this->unflaggedIndex(); } if ($request->get('status')) { return $this->indexByStatus($request->get('status')); } return Topic::active()->get()->map(function ($topic) { return new ApiTopic($topic); }); }