Code Duplication    Length = 12-12 lines in 4 locations

app/Http/ApiControllers/TopicsController.php 4 locations

@@ 263-274 (lines=12) @@
260
     *
261
     * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
262
     */
263
    public function favorite($topic_id)
264
    {
265
        try {
266
            $this->topics->favorite($topic_id, Auth::id());
267
        } catch (\Exception $e) {
268
            $filed = true;
269
        }
270
271
        return response([
272
            'status' => isset($filed) ? false : true,
273
        ]);
274
    }
275
276
    /**
277
     * 取消收藏帖子.
@@ 283-294 (lines=12) @@
280
     *
281
     * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
282
     */
283
    public function unFavorite($topic_id)
284
    {
285
        try {
286
            $this->topics->unFavorite($topic_id, Auth::id());
287
        } catch (\Exception $e) {
288
            $filed = true;
289
        }
290
291
        return response([
292
            'status' => isset($filed) ? false : true,
293
        ]);
294
    }
295
296
    /**
297
     * 关注帖子.
@@ 303-314 (lines=12) @@
300
     *
301
     * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
302
     */
303
    public function attention($topic_id)
304
    {
305
        try {
306
            $this->topics->attention($topic_id, Auth::id());
307
        } catch (\Exception $e) {
308
            $filed = true;
309
        }
310
311
        return response([
312
            'status' => isset($filed) ? false : true,
313
        ]);
314
    }
315
316
    /**
317
     * 取消关注帖子.
@@ 323-334 (lines=12) @@
320
     *
321
     * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
322
     */
323
    public function unAttention($topic_id)
324
    {
325
        try {
326
            $this->topics->unAttention($topic_id, Auth::id());
327
        } catch (\Exception $e) {
328
            $filed = true;
329
        }
330
331
        return response([
332
            'status' => isset($filed) ? false : true,
333
        ]);
334
    }
335
336
    /**
337
     * 注册帖子列表接口通用的引入项.