31 lines
746 B
PHP
Raw Normal View History

2024-12-22 07:46:20 +08:00
<?php
namespace Modules\Common\Repository\Options;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
class Schemas implements OptionInterface
{
public function get(): array
{
$options = [];
2025-04-12 13:29:51 +08:00
$connection = DB::connection();
$databaseName = $connection->getDatabaseName();
$tablePrefix = $connection->getTablePrefix();
2024-12-22 07:46:20 +08:00
2025-04-12 13:29:51 +08:00
foreach (Schema::getTables($databaseName) as $table) {
2024-12-22 07:46:20 +08:00
$tableName = Str::of($table['name'])->remove($tablePrefix);
$options[] = [
'label' => $tableName . "\t\t\t\t" . $table['comment'],
'value' => $tableName,
];
}
return $options;
}
}