mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进unique验证规则
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\exception\ClassNotFoundException;
|
||||
use think\File;
|
||||
use think\Lang;
|
||||
use think\Loader;
|
||||
@@ -817,10 +818,9 @@ class Validate
|
||||
// 指定模型类
|
||||
$db = new $rule[0];
|
||||
} else {
|
||||
$model = Loader::parseClass(Request::instance()->module, 'model', $rule[0]);
|
||||
if (class_exists($model)) {
|
||||
$db = new $model;
|
||||
} else {
|
||||
try {
|
||||
$db = Loader::model($rule[0]);
|
||||
} catch (ClassNotFoundException $e) {
|
||||
$db = Db::name($rule[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user