From 898ce1305dddf7e698b85eba3ada994088bc357a Mon Sep 17 00:00:00 2001 From: JaguarJack <82664165@qq.com> Date: Mon, 15 Apr 2024 09:17:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=20Laravel11=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=A1=A8=E6=A0=8F=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/Develop/Models/Schemas.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/Develop/Models/Schemas.php b/modules/Develop/Models/Schemas.php index a7b7fbc..f6b4598 100644 --- a/modules/Develop/Models/Schemas.php +++ b/modules/Develop/Models/Schemas.php @@ -6,8 +6,8 @@ use Catch\Base\CatchModel; use Catch\Enums\Status; use Exception; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Facades\DB; use Modules\Develop\Support\Generate\Create\Schema; +use Illuminate\Support\Facades\Schema as SchemaFacade; class Schemas extends CatchModel { @@ -90,16 +90,13 @@ class Schemas extends CatchModel { $schema = parent::firstBy($id); - $columns = []; - - foreach (getTableColumns($schema->name) as $columnString) { - $column = DB::connection()->getDoctrineColumn(DB::connection()->getTablePrefix().$schema->name, $columnString); + foreach (SchemaFacade::getColumns($schema->name) as $column) { $columns[] = [ - 'name' => $column->getName(), - 'type' => $column->getType()->getName(), - 'nullable' => ! $column->getNotnull(), - 'default' => $column->getDefault(), - 'comment' => $column->getComment() + 'name' => $column['name'], + 'type' => $column['type_name'], + 'nullable' => $column['nullable'], + 'default' => $column['default'], + 'comment' => $column['comment'], ]; }