浏览代码

增加筛选条件

durong 5 年之前
父节点
当前提交
47bb921e48
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      app/Repositories/V2/FloorRepository.php

+ 5 - 1
app/Repositories/V2/FloorRepository.php

@@ -23,7 +23,11 @@ class FloorRepository
 
     public function index()
     {
-        return $this->floor->paginate(20);
+        $where = [];
+        if(isset($request['id'])){
+            $where[] = ['id', '=', $request['id']];
+        }
+        return $this->floor->where($where)->orderBy('id', 'asc')->paginate(20);
     }
 
     public function create($request)