File tree Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Expand file tree Collapse file tree 3 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ class FetchAllCategoriesQuery implements Query
21
21
public static function fromRequest (Request $ request ): self
22
22
{
23
23
$ query = new self ();
24
+ $ query ->setDefaultLimit (1000 );
24
25
$ query ->setPaging ($ request );
25
26
$ query ->setSearchFields (new CategorySearchFields ($ request ));
26
27
$ query ->addOnlyParameteresFromRequest (
Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ public function toArray($request)
54
54
'available ' => $ this ->translations ->groupBy ('language ' )->keys ()
55
55
];
56
56
}
57
- $ data ['allowed_privileges ' ]= $ this ->getResourcePrivileges ();
57
+ // To Do: this call cause an infinit loop , need to be checked
58
+ // note: it was not found before last commit , so it will not disable it it will not affect the work of front end
59
+ //$data['allowed_privileges']= $this->getResourcePrivileges();
58
60
return $ data ;
59
61
}
60
62
Original file line number Diff line number Diff line change @@ -13,13 +13,14 @@ trait HasPaginate
13
13
private $ paging ;
14
14
private $ default_order ;
15
15
private $ default_sort_by = 'id ' ;
16
- private $ default_limit = '20 ' ;
16
+ private $ default_limit = 20 ;
17
+ private $ default_page = 1 ;
17
18
18
19
public function getPaging (): Paging
19
20
{
20
21
return $ this ->paging ;
21
22
}
22
-
23
+
23
24
public function setPaging (
24
25
Request $ request ,
25
26
$ default_sort_by = null ,
@@ -29,15 +30,28 @@ public function setPaging(
29
30
) {
30
31
$ this ->paging = Paging::fromRequest (
31
32
$ request ,
32
- $ default_sort_by ,
33
- $ default_order ,
34
- $ default_limit ,
35
- $ default_page
33
+ $ default_sort_by ?? $ this -> default_sort_by ,
34
+ $ default_order ?? $ this -> default_order ,
35
+ $ default_limit ?? $ this -> default_limit ,
36
+ $ default_page ?? $ this -> default_page
36
37
);
37
38
}
38
39
39
- public function setDefaultOrder (): void
40
+ public function setDefaultOrder ($ order ): void
41
+ {
42
+ $ this ->default_order = $ order ;
43
+ }
44
+ public function setDefaultSort ($ sort ): void
45
+ {
46
+ $ this ->default_sort_by = $ sort ;
47
+ }
48
+ public function setDefaultLimit ($ limit ): void
49
+ {
50
+ $ this ->default_limit = $ limit ;
51
+ }
52
+
53
+ public function setDefaultPage ($ page ): void
40
54
{
41
- $ this ->paging ;
55
+ $ this ->page = $ page ;
42
56
}
43
57
}
You can’t perform that action at this time.
0 commit comments