File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ protected function setPaginate()
177
177
return $ query ['method ' ] == 'paginate ' ;
178
178
});
179
179
180
- if (! $ this ->usePaginate ) {
180
+ if ($ this ->grid -> isHidePage () ) {
181
181
$ query = [
182
182
'method ' => 'get ' ,
183
183
'arguments ' => [],
@@ -400,10 +400,8 @@ public function displayData($data)
400
400
$ columns = $ this ->grid ->getColumns ();
401
401
$ items = collect ();
402
402
403
-
404
403
foreach ($ data as $ key => $ row ) {
405
404
$ item = [];
406
-
407
405
foreach ($ this ->grid ->getAppendFields () as $ field ) {
408
406
data_set ($ item , $ field , data_get ($ row , $ field ));
409
407
}
@@ -476,19 +474,25 @@ public function get()
476
474
$ this ->model = $ this ->relation ->getQuery ();
477
475
}
478
476
477
+
479
478
$ this ->setSort ();
479
+
480
+
480
481
$ this ->setPaginate ();
481
482
482
483
483
484
$ this ->queries ->unique ()->each (function ($ query ) {
484
485
$ this ->model = call_user_func_array ([$ this ->model , $ query ['method ' ]], $ query ['arguments ' ]);
485
486
});
486
487
487
-
488
488
$ data = $ this ->model ;
489
489
490
490
if ($ this ->model instanceof Collection) {
491
- return $ this ->displayData ($ data );
491
+ if ($ data ->count () > 0 ) {
492
+ return $ this ->displayData ($ data );
493
+ } else {
494
+ return $ data ;
495
+ }
492
496
}
493
497
494
498
if ($ this ->model instanceof LengthAwarePaginator) {
You can’t perform that action at this time.
0 commit comments