ReportController.php
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace App\Http\Container\AdminSection\Controllers\System;
use App\Helpers\OperationLog;
use App\Models\TidingHasReport;
use Hikoon\LaravelApi\Facades\Response;
use Hikoon\LaravelApi\Support\ApiCode;
use Hikoon\LaravelApi\Support\ApiController;
use Illuminate\Http\Request;
class ReportController extends ApiController
{
/**
* @param \Illuminate\Http\Request $request
* @return \Hikoon\LaravelApi\Facades\Response
*/
public function index(Request $request): Response
{
$pageSize = $request->get('pageSize', 20);
$filter = $request->except(['page', 'pageSize']);
$data = TidingHasReport::filter($filter)->paginate($pageSize);
return $this->successWithData($data);
}
/**
* @param \Illuminate\Http\Request $request
* @param \App\Models\TidingHasReport $report
* @return \Hikoon\LaravelApi\Facades\Response
*/
public function update(Request $request, TidingHasReport $report): Response
{
$attribute = $request->validate(['status' => 'required|in:0,1'], ['status.required' => '请选择处理状态', 'status.in' => '处理状态不在指定范围内']);
$report->update($attribute);
OperationLog::admin()->createAction()->subject($report)->content('处理举报编号:', $report->getKey());
return $this->success(ApiCode::UPDATE_SUCCESS);
}
}