Przeglądaj źródła

$table->skip($request->get("offset",0))

visuddhinanda 2 lat temu
rodzic
commit
da017d6ab6
1 zmienionych plików z 1 dodań i 7 usunięć
  1. 1 7
      app/Http/Controllers/SentSimController.php

+ 1 - 7
app/Http/Controllers/SentSimController.php

@@ -33,13 +33,7 @@ class SentSimController extends Controller
                 break;
                 break;
         }
         }
         $count = $table->count();
         $count = $table->count();
-        if(!empty($request->get('limit'))){
-            $offset = 0;
-            if(!empty($request->get("offset"))){
-                $offset = $request->get("offset");
-            }
-            $table->skip($offset)->take($request->get('limit'));
-        }
+        $table->skip($request->get("offset",0))->take($request->get('limit',200));
         $result = $table->get();
         $result = $table->get();
         if($result){
         if($result){
             return $this->ok(["rows"=>SentSimResource::collection($result),"count"=>$count]);
             return $this->ok(["rows"=>SentSimResource::collection($result),"count"=>$count]);