mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
优化Route类的模型绑定
This commit is contained in:
@@ -1348,7 +1348,6 @@ class Route
|
|||||||
$model = $val;
|
$model = $val;
|
||||||
$exception = true;
|
$exception = true;
|
||||||
}
|
}
|
||||||
$model = strpos($model, '\\') ? $model : Loader::model($model);
|
|
||||||
$where = [];
|
$where = [];
|
||||||
$match = true;
|
$match = true;
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
@@ -1360,7 +1359,8 @@ class Route
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($match) {
|
if ($match) {
|
||||||
$result = $model::where($where)->failException($exception)->find();
|
$query = strpos($model, '\\') ? $model::where($where) : Loader::model($model)->where($where);
|
||||||
|
$result = $query->failException($exception)->find();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user