mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-05 17:42:49 +08:00
模型新增快捷缓存查询方法
This commit is contained in:
@@ -102,4 +102,19 @@ class BaseModelBase extends Model
|
||||
{
|
||||
return str_replace('\\', '_', static::class);
|
||||
}
|
||||
|
||||
public static function uGet($id, $cache = false)
|
||||
{
|
||||
if (!isset(static::$uGetList[static::class])) {
|
||||
static::$uGetList[static::class] = [];
|
||||
}
|
||||
|
||||
if (isset(static::$uGetList[static::class][$id])) {
|
||||
return static::$uGetList[static::class][$id];
|
||||
}
|
||||
|
||||
static::$uGetList[static::class][$id] = static::find($id);
|
||||
|
||||
return static::$uGetList[static::class][$id];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user