Skip to content

Commit

Permalink
feat: service table column
Browse files Browse the repository at this point in the history
  • Loading branch information
slowlyo committed Jun 29, 2024
1 parent bd6016e commit 9763b5e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Services/AdminService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class AdminService
{
use ErrorTrait;

protected static $tableColumn;
protected $tableColumn;

protected string $modelName;

Expand Down Expand Up @@ -52,17 +52,17 @@ public function primaryKey()

public function getTableColumns()
{
if (!self::$tableColumn) {
if (!$this->tableColumn) {
try {
// laravel11: sqlite 暂时无法获取字段, 等待 laravel 适配
self::$tableColumn = Schema::connection($this->getModel()->getConnectionName())
$this->tableColumn = Schema::connection($this->getModel()->getConnectionName())
->getColumnListing($this->getModel()->getTable());
} catch (\Throwable $e) {
self::$tableColumn = [];
$this->tableColumn = [];
}
}

return self::$tableColumn;
return $this->tableColumn;
}

public function hasColumn($column)
Expand Down

0 comments on commit 9763b5e

Please sign in to comment.