Completed
Push — master ( 6d8c78...67b47c )
by wen
03:27
created

ActionLogController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getList() 0 19 4
1
<?php
2
3
4
namespace Sco\Admin\Http\Controllers\System;
5
6
7
use Illuminate\Http\Request;
8
use Sco\Admin\Http\Controllers\BaseController;
9
10
class ActionLogController extends BaseController
11
{
12
    public function getList(Request $request)
13
    {
14
        $ActionLog = app('ActionLog');
15
        if ($request->has('user_id')) {
16
            $ActionLog = $ActionLog->where('user_id', intval($request->input('user_id')));
17
        }
18
19
        if ($request->has('client_ip')) {
20
            $ActionLog = $ActionLog->where('client_ip', $request->input('client_ip'));
21
        }
22
23
        if ($request->has('type')) {
24
            $ActionLog = $ActionLog->where('type', $request->input('type'));
25
        }
26
27
        $list = $ActionLog->paginate();
28
29
        return response()->json($list);
30
    }
31
}
32