优化一键生成菜单——判断是否有启用软删除

兼容model('Test')与new \app\admin\model\Test
pull/101/head
PPPSCN 2019-03-01 23:33:02 +08:00
parent 6a5a966829
commit 734c0c46a5
1 changed files with 7 additions and 0 deletions

View File

@ -199,6 +199,13 @@ class Menu extends Command
if (in_array('trashed', get_class_methods($model))) {
$withSofeDelete = true;
}
} else {
preg_match_all("/\\\$this\->model\s*=\s*new\s+([a-zA-Z\\\]+);/", $classContent, $matches);
\think\Request::instance()->module('admin');
$model = new $matches[1][0];
if (in_array('trashed', get_class_methods($model))) {
$withSofeDelete = true;
}
}
//忽略的类
if (stripos($classComment, "@internal") !== false) {