|
|
@@ -16,15 +16,28 @@ class Groupcontroller extends BaseController
|
|
|
/**
|
|
|
* 获取分组列表
|
|
|
*
|
|
|
+ * @param Request $request
|
|
|
* @return mixed
|
|
|
*/
|
|
|
- public function index()
|
|
|
+ public function index(Request $request)
|
|
|
{
|
|
|
+ $title = $request->param('title', '');
|
|
|
+
|
|
|
$groupModel = new GroupModel();
|
|
|
- $groups = $groupModel->select();
|
|
|
+ $query = $groupModel->order('id ASC');
|
|
|
+
|
|
|
+ if (!empty($title)) {
|
|
|
+ $query->whereLike('title', '%' . $title . '%');
|
|
|
+ }
|
|
|
+
|
|
|
+ $list = $query->paginate([
|
|
|
+ 'page' => $request->param('page/d', 1),
|
|
|
+ 'list_rows' => $request->param('pagesize/d', 10),
|
|
|
+ ]);
|
|
|
|
|
|
- return view('index', [
|
|
|
- 'groups' => $groups
|
|
|
+ return View::fetch('index', [
|
|
|
+ 'list' => $list,
|
|
|
+ 'title' => $title,
|
|
|
]);
|
|
|
}
|
|
|
|