Ken 9 stundas atpakaļ
vecāks
revīzija
87ada8e1dc
2 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 1 1
      app/Http/Controllers/admin/User.php
  2. 2 1
      app/Services/UserService.php

+ 1 - 1
app/Http/Controllers/admin/User.php

@@ -72,7 +72,7 @@ class User extends Controller
         } catch (ValidationException $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
         } catch (Exception $e) {
-            return $this->error(intval($e->getCode()));
+            return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
         }
         return $this->success($result);
     }

+ 2 - 1
app/Services/UserService.php

@@ -101,8 +101,9 @@ class UserService extends BaseService
     public static function paginate(array $search = [])
     {
         $limit = isset($search['limit']) ? $search['limit'] : 15;
-        $paginator = static::$MODEL::where(self::getWhere($search))->with(['wallet'])
+        $paginator = static::$MODEL::with(['wallet'])
             ->join('wallets', 'users.member_id', '=', 'wallets.member_id')
+            ->where(self::getWhere($search))
             ->orderByDesc('created_at')->paginate($limit);
         return ['total' => $paginator->total(), 'data' => $paginator->items()];
     }