mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
改进Route
This commit is contained in:
@@ -1339,11 +1339,13 @@ class Route
|
|||||||
$result = call_user_func_array($val, [$matches]);
|
$result = call_user_func_array($val, [$matches]);
|
||||||
} else {
|
} else {
|
||||||
if (is_array($val)) {
|
if (is_array($val)) {
|
||||||
$fields = explode('&', $val[1]);
|
$fields = explode('&', $val[1]);
|
||||||
$model = $val[0];
|
$model = $val[0];
|
||||||
|
$exception = isset($val[2]) ? $val[2] : true;
|
||||||
} else {
|
} else {
|
||||||
$fields = ['id'];
|
$fields = ['id'];
|
||||||
$model = $val;
|
$model = $val;
|
||||||
|
$exception = true;
|
||||||
}
|
}
|
||||||
$where = [];
|
$where = [];
|
||||||
$match = true;
|
$match = true;
|
||||||
@@ -1356,7 +1358,7 @@ class Route
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($match) {
|
if ($match) {
|
||||||
$result = $model::where($where)->findOrFail();
|
$result = $model::where($where)->failException($exception)->find();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user