Code Duplication    Length = 6-6 lines in 2 locations

src/Http/Api/ProjectController.php 2 locations

@@ 343-348 (lines=6) @@
340
        $query = DB::collection('project');
341
342
        $s = $request->input('s');
343
        if (isset($s) && $s) {
344
            $query->where(
345
                function ($query) use ($s) {
346
                    $query->where('key', 'like', '%' . $s . '%')->orWhere('name', 'like', '%' . $s . '%');
347
                }
348
            );
349
        }
350
351
        $projects = $query->take(10)->get([ 'name', 'key' ]);
@@ 376-381 (lines=6) @@
373
        }
374
375
        $name = $request->input('name');
376
        if (isset($name) && $name) {
377
            $query->where(
378
                function ($query) use ($name) {
379
                    $query->where('key', 'like', '%' . $name . '%')->orWhere('name', 'like', '%' . $name . '%');
380
                }
381
            );
382
        }
383
384
        // get total