fix:修复 Laravel11 获取表栏目

This commit is contained in:
JaguarJack 2024-04-15 09:17:33 +08:00
parent 7362bdd70f
commit 898ce1305d

View File

@ -6,8 +6,8 @@ use Catch\Base\CatchModel;
use Catch\Enums\Status; use Catch\Enums\Status;
use Exception; use Exception;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Modules\Develop\Support\Generate\Create\Schema; use Modules\Develop\Support\Generate\Create\Schema;
use Illuminate\Support\Facades\Schema as SchemaFacade;
class Schemas extends CatchModel class Schemas extends CatchModel
{ {
@ -90,16 +90,13 @@ class Schemas extends CatchModel
{ {
$schema = parent::firstBy($id); $schema = parent::firstBy($id);
$columns = []; foreach (SchemaFacade::getColumns($schema->name) as $column) {
foreach (getTableColumns($schema->name) as $columnString) {
$column = DB::connection()->getDoctrineColumn(DB::connection()->getTablePrefix().$schema->name, $columnString);
$columns[] = [ $columns[] = [
'name' => $column->getName(), 'name' => $column['name'],
'type' => $column->getType()->getName(), 'type' => $column['type_name'],
'nullable' => ! $column->getNotnull(), 'nullable' => $column['nullable'],
'default' => $column->getDefault(), 'default' => $column['default'],
'comment' => $column->getComment() 'comment' => $column['comment'],
]; ];
} }