validate([ 'page' => ['nullable', 'integer', 'min:1'], 'limit' => ['nullable', 'integer', 'min:1'], 'from' => ['nullable', 'string'], ]); $page = request()->input('page', 1); $limit = request()->input('limit', 10); $from = request()->input('from', ''); $list = GameplayRule::forPage($page, $limit) ->orderBy('groups') ->orderByDesc('created_at') ->get(); if ($from == 'football') { foreach($list as &$item) { if ($item['id'] <= 8) { $item['groups'] = '热门'; } $item['groups'] = lang($item['groups']); //去掉数字 $special_keywords = preg_replace('/[0-9]/u', '', $item['keywords']); if (in_array($special_keywords, ['操','尾'])) { $item['keywords'] = intval($item['keywords']).lang($special_keywords); } else { $item['keywords'] = lang($item['keywords']); } } } } catch (ValidationException $e) { return $this->error($e->validator->errors()->first()); } catch (Exception $e) { return $this->error($e->getMessage()); } return $this->success($list); } }