From bd2791f1edea3fc95eeaa52f9f1c0b2ec9a6b472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Mon, 19 Jun 2023 18:58:08 +0900 Subject: [PATCH] cfmgrv3 init...2 --- app/Models/Cloudflare/API/AccountModel.php | 4 ++++ app/Models/Cloudflare/API/AuthModel.php | 4 ++++ app/Models/LoggerModel.php | 4 ++++ app/Models/MapurlModel.php | 4 ++++ app/Models/UserModel.php | 15 +++++++++++---- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/Models/Cloudflare/API/AccountModel.php b/app/Models/Cloudflare/API/AccountModel.php index 903eed4..9c4c8d9 100644 --- a/app/Models/Cloudflare/API/AccountModel.php +++ b/app/Models/Cloudflare/API/AccountModel.php @@ -76,6 +76,10 @@ class AccountModel extends Model $this->where('created_at >=', $start); $this->where('created_at <=', $end); } + public function setIndexOrderBy($field, $order = 'ASC') + { + $this->orderBy("title ASC, {$field} {$order}"); + } //존재하는지 체크 public function isUniqueApikey(string $uid): bool diff --git a/app/Models/Cloudflare/API/AuthModel.php b/app/Models/Cloudflare/API/AuthModel.php index eb20cbc..3dbb589 100644 --- a/app/Models/Cloudflare/API/AuthModel.php +++ b/app/Models/Cloudflare/API/AuthModel.php @@ -68,6 +68,10 @@ class AuthModel extends Model $this->where('created_at >=', $start); $this->where('created_at <=', $end); } + public function setIndexOrderBy($field, $order = 'ASC') + { + $this->orderBy("id ASC, {$field} {$order}"); + } //도메인이 이미 존재하는지 체크 public function isUniqueApikey(string $uid): bool diff --git a/app/Models/LoggerModel.php b/app/Models/LoggerModel.php index dc202f3..7e4784a 100644 --- a/app/Models/LoggerModel.php +++ b/app/Models/LoggerModel.php @@ -65,4 +65,8 @@ class LoggerModel extends Model $this->where('created_at >=', $start); $this->where('created_at <=', $end); } + public function setIndexOrderBy($field, $order = 'ASC') + { + $this->orderBy("title ASC, {$field} {$order}"); + } } diff --git a/app/Models/MapurlModel.php b/app/Models/MapurlModel.php index 4abc08e..210c99c 100644 --- a/app/Models/MapurlModel.php +++ b/app/Models/MapurlModel.php @@ -64,4 +64,8 @@ class MapurlModel extends Model $this->where('created_at >=', $start); $this->where('created_at <=', $end); } + public function setIndexOrderBy($field, $order = 'ASC') + { + $this->orderBy("oldurl ASC, {$field} {$order}"); + } } diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index bbbfaae..c7c55c0 100644 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -1,6 +1,7 @@ asObject(UserEntity::class)->where('uid',$uid)->first(); - if(is_null($entity)){ throw new \Exception(__METHOD__."에서 {$uid} 해당 정보가 없습니다."); } + $entity = $this->asObject(UserEntity::class)->where('uid', $uid)->first(); + if (is_null($entity)) { + throw new \Exception(__METHOD__ . "에서 {$uid} 해당 정보가 없습니다."); + } return $entity;; } @@ -62,9 +65,13 @@ class UserModel extends Model $this->orLike('id', $word, 'both'); $this->orLike('name', $word, 'both'); //befor , after , both } - public function setIndexDateFilter($start,$end) + public function setIndexDateFilter($start, $end) { $this->where('created_at >=', $start); $this->where('created_at <=', $end); } + public function setIndexOrderBy($field, $order = 'ASC') + { + $this->orderBy("name ASC, {$field} {$order}"); + } }