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

ActionLogController::getList()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 19
rs 9.2
c 1
b 0
f 0
cc 4
eloc 10
nc 8
nop 1
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