fly 4 rokov pred
rodič
commit
6e697924de

+ 1 - 0
src/Requests/Book/OnShelfBookRequest.php

@@ -20,6 +20,7 @@ class OnShelfBookRequest extends Request
             'key' => 'string',
             'roles' => 'string',
             'firstChapterContent' => 'string',
+            'bid_order' => ['string', Rule::in('asc', 'desc')],
         ];
     }
 }

+ 3 - 0
src/Services/Book/BookService.php

@@ -87,6 +87,9 @@ class BookService
         if (isset($params['weekly_promotion']) && $params['weekly_promotion']) {
             $sql->where('is_current_week_promotion', $params['weekly_promotion']);
         }
+        if (isset($params['bid_order']) && $params['bid_order']) {
+            $sql->orderBy('bid', $params['bid_order']);
+        }
         $this->slowQueryParams($sql, $params);
         if ($is_page) {
             return $sql->paginate();