cfmgrv3 init...2

This commit is contained in:
최준흠 2023-06-19 18:58:08 +09:00
parent 4d840ecd98
commit bd2791f1ed
5 changed files with 27 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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}");
}
}

View File

@ -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}");
}
}

View File

@ -1,6 +1,7 @@
<?php
namespace App\Models;
use App\Entities\UserEntity;
use CodeIgniter\Model;
@ -14,7 +15,7 @@ class UserModel extends Model
protected $returnType = 'array'; //object,array,entity명::class
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['id','passwd','name','email','role','status','updated_at','created_at'];
protected $allowedFields = ['id', 'passwd', 'name', 'email', 'role', 'status', 'updated_at', 'created_at'];
// Dates
protected $useTimestamps = true;
@ -52,8 +53,10 @@ class UserModel extends Model
public function getEntity(int $uid): null|UserEntity
{
$entity = $this->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}");
}
}