|
|
@@ -22,7 +22,7 @@ class LogController extends Controller
|
|
|
* Display a listing of the resource.
|
|
|
*
|
|
|
* @param Request $request
|
|
|
- * @return LengthAwarePaginator
|
|
|
+ * @return Application|LengthAwarePaginator|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
|
|
*/
|
|
|
public function index(Request $request)
|
|
|
{
|
|
|
@@ -46,8 +46,7 @@ class LogController extends Controller
|
|
|
session()->flash('warning', '请选择开始时间');
|
|
|
return view('maintenance.log.index', ['logs' => null]);
|
|
|
}
|
|
|
- $query = Log::query()
|
|
|
- ->orderBy('id', 'desc');
|
|
|
+ $query = Log::query();
|
|
|
if ($request->has('operation')) {
|
|
|
$query->where('operation', 'like', $request->operation . '%');
|
|
|
}
|
|
|
@@ -66,8 +65,8 @@ class LogController extends Controller
|
|
|
if ($request->has('created_at_end')) {
|
|
|
$query->where('created_at', '<=', $request->created_at_end);
|
|
|
}
|
|
|
-
|
|
|
- $logs = $query->paginate($request->paginate);
|
|
|
+ $query->orderByDesc('created_at');
|
|
|
+ $logs = $query->paginate($request->paginate??50);
|
|
|
return view('maintenance.log.index', ['logs' => $logs]);
|
|
|
}
|
|
|
|