From 42200f179f52f867e5e3156a92d48160a5feae3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=99=E7=A0=81=E7=94=9F=E8=8A=B1?= <18523774412@qq.com> Date: Wed, 19 Jul 2023 04:48:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=E4=BC=98=E5=8C=96=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E5=85=B3=E8=81=94=E5=AD=97=E6=AE=B5=E5=90=8E=E7=BC=80=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/crud/Crud.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/controller/crud/Crud.php b/app/admin/controller/crud/Crud.php index 5972de96..500cdbde 100644 --- a/app/admin/controller/crud/Crud.php +++ b/app/admin/controller/crud/Crud.php @@ -564,7 +564,7 @@ class Crud extends Backend $columns = Helper::parseTableColumns($field['form']['remote-table'], true); $relationFields = explode(',', $field['form']['relation-fields']); $tableName = TableManager::tableName($field['form']['remote-table'], false); - $relationName = parse_name(rtrim(rtrim($field['name'], '_ids'), '_id'), 1, false); + $relationName = parse_name(preg_replace('/(.*)(_ids|_id)$/', '$1', $field['name']), 1, false); // 建立关联模型代码文件 if (!$field['form']['remote-model'] || !file_exists(root_path() . $field['form']['remote-model'])) {