正在显示
1 个修改的文件
包含
3 行增加
和
1 行删除
@@ -192,7 +192,9 @@ class Menu extends Command | @@ -192,7 +192,9 @@ class Menu extends Command | ||
192 | //判断是否有启用软删除 | 192 | //判断是否有启用软删除 |
193 | $softDeleteMethods = ['destroy', 'restore', 'recyclebin']; | 193 | $softDeleteMethods = ['destroy', 'restore', 'recyclebin']; |
194 | $withSofeDelete = false; | 194 | $withSofeDelete = false; |
195 | - preg_match_all("/\\\$this\->model\s*=\s*model\('(\w+)'\);/", $classContent, $matches); | 195 | + $modelRegexArr = ["/\\\$this\->model\s*=\s*model\(['|\"](\w+)['|\"]\);/", "/\\\$this\->model\s*=\s*new\s+([a-zA-Z\\\]+);/"]; |
196 | + $modelRegex = preg_match($modelRegexArr[0], $classContent) ? $modelRegexArr[0] : $modelRegexArr[1]; | ||
197 | + preg_match_all($modelRegex, $classContent, $matches); | ||
196 | if (isset($matches[1]) && isset($matches[1][0]) && $matches[1][0]) { | 198 | if (isset($matches[1]) && isset($matches[1][0]) && $matches[1][0]) { |
197 | \think\Request::instance()->module('admin'); | 199 | \think\Request::instance()->module('admin'); |
198 | $model = model($matches[1][0]); | 200 | $model = model($matches[1][0]); |
-
请 注册 或 登录 后发表评论