|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Yeelight\Http\Controllers\Backend; |
|
4
|
|
|
|
|
5
|
|
|
use Yeelight\Models\AdminOperationLog; |
|
6
|
|
|
use Yeelight\Repositories\Interfaces\AdminOperationLogRepository; |
|
7
|
|
|
use Yeelight\Repositories\Interfaces\AdminUserRepository; |
|
8
|
|
|
use Yeelight\Validators\AdminOperationLogValidator; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class AdminOperationLogsController |
|
12
|
|
|
* |
|
13
|
|
|
* @category Yeelight |
|
14
|
|
|
* |
|
15
|
|
|
* @package Yeelight\Http\Controllers\Backend |
|
16
|
|
|
* |
|
17
|
|
|
* @author Sheldon Lee <[email protected]> |
|
18
|
|
|
* |
|
19
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
|
20
|
|
|
* |
|
21
|
|
|
* @link https://www.yeelight.com |
|
22
|
|
|
*/ |
|
23
|
|
|
class AdminOperationLogsController extends BaseController |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @var AdminOperationLogRepository |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $repository; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var AdminOperationLogValidator |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $validator; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var AdminUserRepository |
|
37
|
|
|
*/ |
|
38
|
|
|
private $userRepository; |
|
39
|
|
|
|
|
40
|
|
|
public function __construct( |
|
41
|
|
|
AdminOperationLogRepository $repository, |
|
42
|
|
|
AdminOperationLogValidator $validator, |
|
43
|
|
|
AdminUserRepository $userRepository |
|
44
|
|
|
) { |
|
45
|
|
|
$this->repository = $repository; |
|
46
|
|
|
$this->validator = $validator; |
|
47
|
|
|
$this->userRepository = $userRepository; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Display a listing of the resource. |
|
52
|
|
|
* |
|
53
|
|
|
* @return \Illuminate\Http\Response |
|
54
|
|
|
*/ |
|
55
|
|
|
public function index() |
|
56
|
|
|
{ |
|
57
|
|
|
$columns = trans('admin_operation_logs.columns'); |
|
58
|
|
|
$adminUsers = $this->userRepository->pluck('name', 'id'); |
|
59
|
|
|
$lists = $this->repository->orderBy('created_at', 'desc')->paginate(null, ['*']); |
|
60
|
|
|
$paginator = $this->backendPagination($lists); |
|
61
|
|
|
|
|
62
|
|
|
//导出 |
|
63
|
|
|
$this->setupExporter(); |
|
64
|
|
|
|
|
65
|
|
|
return view('backend.admin_operation_logs.index', [ |
|
|
|
|
|
|
66
|
|
|
'lists' => $lists, |
|
67
|
|
|
'columns' => $columns, |
|
68
|
|
|
'adminUsers' => $adminUsers, |
|
69
|
|
|
'methods' => AdminOperationLog::$methods, |
|
70
|
|
|
'paginator' => $paginator, |
|
71
|
|
|
'query' => request()->query(), |
|
72
|
|
|
]); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|