mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-08-30 12:45:32 +08:00
Model类get方法使用主键查询自动缓存
This commit is contained in:
@@ -985,6 +985,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
*/
|
||||
public static function get($data = null, $with = [], $cache = false)
|
||||
{
|
||||
if (!$cache && $data && is_scalar($data)) {
|
||||
$cache = true;
|
||||
}
|
||||
$query = static::parseQuery($data, $with, $cache);
|
||||
return $query->find($data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user