Parcourir la source

增加筛选条件

durong il y a 5 ans
Parent
commit
47bb921e48
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  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)