diff --git a/front/js/svelte/libs/Trix.svelte b/front/js/svelte/libs/Trix.svelte
index a9186a6..566b550 100644
--- a/front/js/svelte/libs/Trix.svelte
+++ b/front/js/svelte/libs/Trix.svelte
@@ -28,6 +28,15 @@
editor.addEventListener("trix-file-accept", (e) => {
e.preventDefault();
})
+
+ editor.addEventListener("trix-before-initialize", (e) => {
+ Trix.config.blockAttributes.heading1.tagName = 'h2';
+ const { toolbarElement } = e.target
+ const h1Button = toolbarElement.querySelector("[data-trix-attribute=heading1]")
+ h1Button.insertAdjacentHTML("afterend", ``)
+ })
+
+
})
// onDestroy(() => {
// editor.removeEventListener("trix-before-initialize")
@@ -35,7 +44,13 @@
Trix.config.blockAttributes.default.breakOnReturn = false
- console.log(Trix.config)
+ Trix.config.blockAttributes.heading3 = {
+ tagName: 'h3',
+ terminal: true,
+ breakOnReturn: true,
+ group: false
+ }
+ // console.log(Trix.config)
diff --git a/front/sass/_codemirror.scss b/front/sass/_codemirror.scss
index fa6ad18..da56317 100644
--- a/front/sass/_codemirror.scss
+++ b/front/sass/_codemirror.scss
@@ -7,11 +7,16 @@
.cm-content{
background-color: var(--p10);
+ color: var(--p100);
}
}
.cm-content{
background-color: var(--p20);
+
+}
+.ͼ4 .cm-line ::selection, .ͼ4 .cm-line::selection{
+ background: var(--p40) !important;
}
.cm-activeLine{
diff --git a/front/sass/_typography.scss b/front/sass/_typography.scss
index f4a2ad1..a5f99d3 100644
--- a/front/sass/_typography.scss
+++ b/front/sass/_typography.scss
@@ -22,6 +22,11 @@
line-height: 30px;
}
+ h3{
+ font-size: 18px;
+ line-height: 28px;
+ }
+
ul {
padding: 0 0 0 16px;
list-style: none outside none;
diff --git a/src/Account/UserRepo.php b/src/Account/UserRepo.php
index 7231ca6..84d638f 100644
--- a/src/Account/UserRepo.php
+++ b/src/Account/UserRepo.php
@@ -3,7 +3,7 @@
namespace Lucent\Account;
use Carbon\Carbon;
-use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
use Lucent\Primitive\Collection;
use PhpOption\Option;
@@ -12,7 +12,7 @@ class UserRepo
public function count(): int
{
- return DB::table("users")->count();
+ return Database::make()->table("users")->count();
}
/**
@@ -20,7 +20,7 @@ class UserRepo
*/
public function all(): Collection
{
- $usersData = DB::table("users")->get();
+ $usersData = Database::make()->table("users")->get();
$users = array_map(fn($userData) => $this->fromArray((array)$userData), $usersData->toArray());
return new Collection($users);
@@ -31,14 +31,14 @@ class UserRepo
{
$userData = toArray($user);
$userData["roles"] = json_encode($userData["roles"]);
- DB::table("users")->insert($userData);
+ Database::make()->table("users")->insert($userData);
}
public function update(User $user): void
{
$userData = toArray($user);
$userData["roles"] = json_encode($userData["roles"]);
- DB::table("users")->where("id", $user->id)->update($userData);
+ Database::make()->table("users")->where("id", $user->id)->update($userData);
}
@@ -46,7 +46,7 @@ class UserRepo
{
$newToken = Token::new(32);
- DB::table("users")
+ Database::make()->table("users")
->where("id", $id)
->update([
'loggedInAt' => Carbon::now()->toJson(),
@@ -62,7 +62,7 @@ class UserRepo
*/
public function findByEmail(Email $email): Option
{
- $user = DB::table("users")->where("email", $email->value())->first();
+ $user = Database::make()->table("users")->where("email", $email->value())->first();
if (empty($user)) {
return none();
@@ -76,7 +76,7 @@ class UserRepo
*/
public function findById(string $id): Option
{
- $user = DB::table("users")->where("id", $id)->first();
+ $user = Database::make()->table("users")->where("id", $id)->first();
if (empty($user)) {
return none();
@@ -88,12 +88,12 @@ class UserRepo
public function updateName(string $userId, Name $name): void
{
- DB::table("users")->where("id", $userId)->update(["name" => $name->value]);
+ Database::make()->table("users")->where("id", $userId)->update(["name" => $name->value]);
}
public function updateEmail(string $userId, Email $email): void
{
- DB::table("users")->where("id", $userId)->update(["email" => $email->value()]);
+ Database::make()->table("users")->where("id", $userId)->update(["email" => $email->value()]);
}
public function fromArray(array $data): User
@@ -102,7 +102,7 @@ class UserRepo
id: $data["id"],
name: new Name($data["name"] ?? ""),
email: new Email($data["email"]),
- roles: json_decode($data["roles"] ?? "[]",true),
+ roles: json_decode($data["roles"] ?? "[]", true),
createdAt: $data["createdAt"],
updatedAt: $data["updatedAt"],
loggedInAt: $data["loggedInAt"] ?? null,
diff --git a/src/Command/CommandRepo.php b/src/Command/CommandRepo.php
index ad87ba6..4e84fd6 100644
--- a/src/Command/CommandRepo.php
+++ b/src/Command/CommandRepo.php
@@ -2,15 +2,15 @@
namespace Lucent\Command;
-use Illuminate\Support\Facades\DB;
use Lucent\Command\Data\CommandLogItem;
+use Lucent\Database\Database;
class CommandRepo
{
public function findBySignature($signature): ?CommandLogItem
{
- $row = DB::table("command_logs")->where("signature", $signature)->first();
+ $row = Database::make()->table("command_logs")->where("signature", $signature)->first();
if (empty($row)) {
return null;
}
@@ -22,16 +22,16 @@ class CommandRepo
{
$foundCommandLogItem = $this->findBySignature($commandLogItem->signature);
if (empty($foundCommandLogItem)) {
- DB::table("command_logs")->insert(toArray($commandLogItem));
+ Database::make()->table("command_logs")->insert(toArray($commandLogItem));
return;
}
- DB::table("command_logs")->where("signature", $commandLogItem->signature)->update(toArray($commandLogItem));
+ Database::make()->table("command_logs")->where("signature", $commandLogItem->signature)->update(toArray($commandLogItem));
}
public function appendToLogs(string $signature, string $line): void
{
- $res = DB::update(
+ Database::make()->update(
'update command_logs set logs = logs || ? where signature = ?',
[$line, $signature]
);
diff --git a/src/Commands/SetupDatabase.php b/src/Commands/SetupDatabase.php
index 74bd602..d8c2c97 100644
--- a/src/Commands/SetupDatabase.php
+++ b/src/Commands/SetupDatabase.php
@@ -4,7 +4,7 @@ namespace Lucent\Commands;
use Illuminate\Console\Command;
use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
+use Lucent\Database\Database;
class SetupDatabase extends Command
{
@@ -27,7 +27,7 @@ class SetupDatabase extends Command
private function tableUsers(): void
{
- Schema::create('users', function (Blueprint $table) {
+ Database::make()->getSchemaBuilder()->create('users', function (Blueprint $table) {
$table->uuid("id")->primary();
$table->string('name')->nullable();
$table->string('email')->unique();
@@ -42,7 +42,7 @@ class SetupDatabase extends Command
private function tableSessions(): void
{
- Schema::create('sessions', function (Blueprint $table) {
+ Database::make()->getSchemaBuilder()->create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
@@ -54,7 +54,7 @@ class SetupDatabase extends Command
private function tableRecords(): void
{
- Schema::create('records', function (Blueprint $table) {
+ Database::make()->getSchemaBuilder()->create('records', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('schema');
$table->string('status');
@@ -67,7 +67,7 @@ class SetupDatabase extends Command
$table->index('search');
});
- Schema::create('edges', function (Blueprint $table) {
+ Database::make()->getSchemaBuilder()->create('edges', function (Blueprint $table) {
$table->uuid('source');
$table->uuid('target');
$table->string('sourceSchema');
@@ -81,7 +81,7 @@ class SetupDatabase extends Command
private function tableRevisions(): void
{
- Schema::create('revisions', function (Blueprint $table) {
+ Database::make()->getSchemaBuilder()->create('revisions', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('recordId');
$table->string('schema');
@@ -94,7 +94,7 @@ class SetupDatabase extends Command
private function tableCommandLogs(): void
{
- Schema::create('command_logs', function (Blueprint $table) {
+ Database::make()->getSchemaBuilder()->create('command_logs', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('signature');
$table->integer('pid')->nullable();
diff --git a/src/Database/Database.php b/src/Database/Database.php
new file mode 100644
index 0000000..34c4f22
--- /dev/null
+++ b/src/Database/Database.php
@@ -0,0 +1,16 @@
+insert($edge->toDB());
+ Database::make()->table("edges")->insert($edge->toDB());
} catch (PDOException $e) {
if ($e->getCode() == 23505) {
throw new LucentException("Edge already exists");
@@ -34,7 +34,7 @@ class EdgeRepo
{
$edgesDB = collect($edges)->map(fn($e) => $e->toDB())->toArray();
try {
- DB::table("edges")->insert($edgesDB);
+ Database::make()->table("edges")->insert($edgesDB);
} catch (PDOException $e) {
if ($e->getCode() == 23505) {
throw new LucentException("Edge already exists");
@@ -52,8 +52,8 @@ class EdgeRepo
public function replaceForRecord(string $from, array $edges): void
{
$edgesDB = collect($edges)->map(fn($e) => $e->toDB())->toArray();
- DB::table("edges")->where("source", $from)->delete();
- DB::table("edges")->insert($edgesDB);
+ Database::make()->table("edges")->where("source", $from)->delete();
+ Database::make()->table("edges")->insert($edgesDB);
}
@@ -62,13 +62,13 @@ class EdgeRepo
*/
public function findAll(): array
{
- $edges = DB::table("edges")->get();
+ $edges = Database::make()->table("edges")->get();
return $edges->map([$this, 'mapEdge'])->toArray();
}
public function findForSource(string $recordId): array
{
- $edges = DB::table("edges")->where("source", $recordId)->get();
+ $edges = Database::make()->table("edges")->where("source", $recordId)->get();
return $edges->map([$this, 'mapEdge'])->toArray();
}
@@ -89,7 +89,7 @@ class EdgeRepo
public function remove(Edge $edge): void
{
- DB::table("edges")
+ Database::make()->table("edges")
->where("source", $edge->source)
->where("target", $edge->target)
->where("sourceSchema", $edge->sourceSchema)
@@ -100,7 +100,7 @@ class EdgeRepo
public function findLastEdgeRank(string $source, string $field): string
{
- $data = DB::table("edges")
+ $data = Database::make()->table("edges")
->where("source", $source)
->where("field", $field)
->orderBy("rank", "desc")
diff --git a/src/File/FileService.php b/src/File/FileService.php
index f53da2a..723bec1 100644
--- a/src/File/FileService.php
+++ b/src/File/FileService.php
@@ -5,11 +5,11 @@ namespace Lucent\File;
use Exception;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Http\UploadedFile;
-use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Intervention\Image\ImageManagerStatic;
use Lucent\Channel\ChannelService;
+use Lucent\Database\Database;
use Lucent\LucentException;
use Lucent\Record\FileData as RecordFile;
use Lucent\Record\QueryRecord;
@@ -129,7 +129,7 @@ class FileService
private function checkDuplicate(string $schemaName, string $checksum, int $filesize): string
{
- $record = DB::table("records")
+ $record = Database::make()->table("records")
->where("schema", $schemaName)
->where("_file->checksum", $checksum)
->where("_file->size", $filesize)
diff --git a/src/Query/DatabaseGraph/PgsqlDatabaseGraph.php b/src/Query/DatabaseGraph/PgsqlDatabaseGraph.php
index 32f008f..606e1b1 100644
--- a/src/Query/DatabaseGraph/PgsqlDatabaseGraph.php
+++ b/src/Query/DatabaseGraph/PgsqlDatabaseGraph.php
@@ -3,6 +3,7 @@
namespace Lucent\Query\DatabaseGraph;
use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
use Lucent\Query\QueryOptions;
class PgsqlDatabaseGraph implements DatabaseGraph
@@ -13,7 +14,7 @@ class PgsqlDatabaseGraph implements DatabaseGraph
*/
public function getChildren(array $ids, QueryOptions $options): array
{
- $subquery = DB::table('edges AS g')
+ $subquery = Database::make()->table('edges AS g')
->select(DB::raw('g.source,g.target,g.rank,"g"."sourceSchema","g"."targetSchema",g.field, 1 as depth '))
->whereIn('source', $ids);
@@ -23,14 +24,14 @@ class PgsqlDatabaseGraph implements DatabaseGraph
$subquery->limit($options->childrenLimit)
->unionAll(
- DB::table(DB::raw("edges AS g, search_graph AS sg "))
+ Database::make()->table(DB::raw("edges AS g, search_graph AS sg "))
->selectRaw('g.source,g.target,g.rank,"g"."sourceSchema","g"."targetSchema",g.field,sg.depth + 1 as depth')
->whereRaw("g.source = sg.target")
->where("depth", "<", $options->childrenDepth)
->orderBy("rank")
);
- return DB::table('search_graph')
+ return Database::make()->table('search_graph')
// ->select(DB::raw("*, 1 as depth "))
->withRecursiveExpression('search_graph', $subquery)
->get()->toArray();
@@ -41,19 +42,19 @@ class PgsqlDatabaseGraph implements DatabaseGraph
*/
public function getParents(array $ids, QueryOptions $options): array
{
- $subquery = DB::table('edges AS g')
+ $subquery = Database::make()->table('edges AS g')
->select(DB::raw('g.source,g.target,g.rank,"g"."sourceSchema","g"."targetSchema",g.field, 1 as depth '))
->limit($options->parentsLimit)
->whereIn('g.target', $ids)
->unionAll(
- DB::table(DB::raw("edges AS g, search_graph AS sg "))
+ Database::make()->table(DB::raw("edges AS g, search_graph AS sg "))
->selectRaw('g.source,g.target,g.rank,"g"."sourceSchema","g"."targetSchema",g.field,sg.depth + 1 as depth')
->whereRaw("g.target = sg.source")
->where("depth", "<", $options->parentsDepth)
->orderBy("rank")
);
- return DB::table('search_graph')
+ return Database::make()->table('search_graph')
// ->select(DB::raw('sg.source,sg.target,sg.rank,sg."sourceSchema",sg."targetSchema",sg.field,sg.depth'))
->withRecursiveExpression('search_graph', $subquery)
->get()->toArray();
diff --git a/src/Query/DatabaseGraph/SqliteDatabaseGraph.php b/src/Query/DatabaseGraph/SqliteDatabaseGraph.php
index 26d69b6..423bad0 100644
--- a/src/Query/DatabaseGraph/SqliteDatabaseGraph.php
+++ b/src/Query/DatabaseGraph/SqliteDatabaseGraph.php
@@ -3,6 +3,7 @@
namespace Lucent\Query\DatabaseGraph;
use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
use Lucent\Query\QueryOptions;
class SqliteDatabaseGraph implements DatabaseGraph
@@ -12,7 +13,7 @@ class SqliteDatabaseGraph implements DatabaseGraph
*/
public function getChildren(array $ids, QueryOptions $options): array
{
- $subquery = DB::table('edges AS g')
+ $subquery = Database::make()->table('edges AS g')
->select(DB::raw('g.source,g.target,g.rank,g.sourceSchema,g.targetSchema,g.field, 1 as depth '))
->whereIn('source', $ids);
@@ -22,14 +23,14 @@ class SqliteDatabaseGraph implements DatabaseGraph
$subquery->limit($options->childrenLimit)
->unionAll(
- DB::table(DB::raw("edges AS g, search_graph AS sg "))
+ Database::make()->table(DB::raw("edges AS g, search_graph AS sg "))
->selectRaw('g.source,g.target,g.rank,"g"."sourceSchema","g"."targetSchema",g.field,sg.depth + 1 as depth')
->whereRaw("g.source = sg.target")
->where("depth", "<", $options->childrenDepth)
->orderBy("rank")
);
- return DB::table('search_graph')
+ return Database::make()->table('search_graph')
// ->select(DB::raw("*, 1 as depth "))
->withRecursiveExpression('search_graph', $subquery)
->get()->toArray();
@@ -40,19 +41,19 @@ class SqliteDatabaseGraph implements DatabaseGraph
*/
public function getParents(array $ids, QueryOptions $options): array
{
- $subquery = DB::table('edges AS g')
+ $subquery = Database::make()->table('edges AS g')
->select(DB::raw('g.source,g.target,g.rank,"g"."sourceSchema","g"."targetSchema",g.field, 1 as depth '))
->limit($options->parentsLimit)
->whereIn('g.target', $ids)
->unionAll(
- DB::table(DB::raw("edges AS g, search_graph AS sg "))
+ Database::make()->table(DB::raw("edges AS g, search_graph AS sg "))
->selectRaw('g.source,g.target,g.rank,"g"."sourceSchema","g"."targetSchema",g.field,sg.depth + 1 as depth')
->whereRaw("g.target = sg.source")
->where("depth", "<", $options->parentsDepth)
->orderBy("rank")
);
- return DB::table('search_graph')
+ return Database::make()->table('search_graph')
// ->select(DB::raw('sg.source,sg.target,sg.rank,sg."sourceSchema",sg."targetSchema",sg.field,sg.depth'))
->withRecursiveExpression('search_graph', $subquery)
->get()->toArray();
diff --git a/src/Query/FilterParser.php b/src/Query/FilterParser.php
index 7685bb7..0bbfae7 100644
--- a/src/Query/FilterParser.php
+++ b/src/Query/FilterParser.php
@@ -4,7 +4,7 @@ namespace Lucent\Query;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Database\Query\Builder;
-use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
use Lucent\Query\BuilderConverter\BuilderConverter;
use Lucent\Query\Filter\AndFilter;
use Lucent\Query\Filter\Argument;
@@ -58,7 +58,7 @@ final class FilterParser
}
$targetIds = collect($graph->records)->pluck("id");
- $sourceIds = DB::table("edges")->whereIn("target", $targetIds)->where("field", $k)->get()->pluck("source");
+ $sourceIds = Database::make()->table("edges")->whereIn("target", $targetIds)->where("field", $k)->get()->pluck("source");
return array_merge($c, $sourceIds->toArray());
}, []);
diff --git a/src/Query/Query.php b/src/Query/Query.php
index 35f5dcb..cc2b24b 100644
--- a/src/Query/Query.php
+++ b/src/Query/Query.php
@@ -3,7 +3,7 @@
namespace Lucent\Query;
use Illuminate\Database\Query\Builder;
-use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
use Lucent\Edge\Edge;
use Lucent\Primitive\Collection;
use Lucent\Query\DatabaseGraph\DatabaseGraph;
@@ -67,7 +67,7 @@ final class Query
$edgesIds = collect($resultParentSourceTargetIds)->merge($resultChildrenEdgesTargetIds)->unique()->values()->toArray();
$edgeRecords = [];
if (!empty($edgesIds)) {
- $edgeRecords = DB::table('records')
+ $edgeRecords = Database::make()->table('records')
->whereIn("id", $edgesIds)
->whereIn("status", $this->options->status)
->get()->toArray();
@@ -142,7 +142,7 @@ final class Query
private function mainQuery(): array
{
- $query = DB::table("records");
+ $query = Database::make()->table("records");
$query = $this->parseFilters($query);
$query = $this->findNotLinked($query);
@@ -189,7 +189,7 @@ final class Query
function runWithCount(): Graph
{
- $query = DB::table("records");
+ $query = Database::make()->table("records");
$query = $this->parseFilters($query);
$query = $this->findNotLinked($query);
$graph = $this->run();
diff --git a/src/Record/RecordRepo.php b/src/Record/RecordRepo.php
index 4bd61da..a8dcd89 100644
--- a/src/Record/RecordRepo.php
+++ b/src/Record/RecordRepo.php
@@ -2,7 +2,7 @@
namespace Lucent\Record;
-use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
class RecordRepo
{
@@ -14,7 +14,7 @@ class RecordRepo
{
$recordToDB = $record->toDB();
- DB::table("records")->insert($recordToDB);
+ Database::make()->table("records")->insert($recordToDB);
}
@@ -23,7 +23,7 @@ class RecordRepo
*/
public static function updateStatusBulk(Status $status, array $ids): void
{
- DB::table("records")->whereIn("id", $ids)->update([
+ Database::make()->table("records")->whereIn("id", $ids)->update([
'status' => $status->value
]);
}
@@ -31,7 +31,7 @@ class RecordRepo
public static function update(Record $record): void
{
$recordToDB = $record->toDB();
- DB::table("records")->where("id", $record->id)->update($recordToDB);
+ Database::make()->table("records")->where("id", $record->id)->update($recordToDB);
}
@@ -43,17 +43,17 @@ class RecordRepo
): void
{
- DB::table("records")->whereIn("id", $ids)->delete();
- DB::table("edges")->whereIn("source", $ids)->delete();
- DB::table("edges")->whereIn("target", $ids)->delete();
- DB::table("revisions")->whereIn("recordId", $ids)->delete();
+ Database::make()->table("records")->whereIn("id", $ids)->delete();
+ Database::make()->table("edges")->whereIn("source", $ids)->delete();
+ Database::make()->table("edges")->whereIn("target", $ids)->delete();
+ Database::make()->table("revisions")->whereIn("recordId", $ids)->delete();
}
public function deleteTrashedBySchema(
string $schemaName,
): void
{
- $ids = DB::table("records")
+ $ids = Database::make()->table("records")
->where("schema", $schemaName)
->where("status", Status::TRASHED->value)
->get()->pluck("id")->toArray();
diff --git a/src/Revision/RevisionRepo.php b/src/Revision/RevisionRepo.php
index a9a78dd..7412d62 100644
--- a/src/Revision/RevisionRepo.php
+++ b/src/Revision/RevisionRepo.php
@@ -2,7 +2,7 @@
namespace Lucent\Revision;
-use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
use Lucent\Edge\Edge;
use Lucent\Primitive\Collection;
use Lucent\Record\FileData;
@@ -19,7 +19,7 @@ class RevisionRepo
public function create(Revision $revision): string
{
$revisionDB = $this->toDB($revision);
- DB::table($this->table)->insert($revisionDB);
+ Database::make()->table($this->table)->insert($revisionDB);
return $revision->id;
}
@@ -29,7 +29,7 @@ class RevisionRepo
**/
public function getByRecordId(string $rid): Collection
{
- $revisions = DB::table($this->table)
+ $revisions = Database::make()->table($this->table)
->where("recordId", $rid)
->get()
->map([$this, 'fromDB'])
@@ -41,7 +41,7 @@ class RevisionRepo
public function cleanupRecord(string $rid, int $numKeep): void
{
- $revisionIds = DB::table($this->table)
+ $revisionIds = Database::make()->table($this->table)
->where("recordId", $rid)
->orderBy("_sys->version", "desc")
->limit(100)
@@ -49,7 +49,7 @@ class RevisionRepo
->get()
->pluck("id");
- DB::table($this->table)
+ Database::make()->table($this->table)
->whereIn("id", $revisionIds)
->delete();
}
@@ -61,7 +61,7 @@ class RevisionRepo
public function getByRecordIdAndVersion(string $rid, int $version): Option
{
- $res = DB::table($this->table)
+ $res = Database::make()->table($this->table)
->where("recordId", $rid)
->where('_sys->version', $version)->first();
diff --git a/src/Setup/Step/DatabaseSetupStep.php b/src/Setup/Step/DatabaseSetupStep.php
index 0bb4b12..60112fa 100644
--- a/src/Setup/Step/DatabaseSetupStep.php
+++ b/src/Setup/Step/DatabaseSetupStep.php
@@ -3,7 +3,7 @@
namespace Lucent\Setup\Step;
use Illuminate\Database\QueryException;
-use Illuminate\Support\Facades\DB;
+use Lucent\Database\Database;
use Lucent\Setup\Data\SetupStep;
class DatabaseSetupStep implements IStep
@@ -13,21 +13,18 @@ class DatabaseSetupStep implements IStep
{
-
-
-
$name = "Database Connection";
+ $databaseConnectionName = config("lucent.database");
-
- $databaseConfig = config('database.connections.lucentdb');
- if(empty($databaseConfig)) {
+ $databaseConfig = config('database.connections.'.$databaseConnectionName);
+ if (empty($databaseConfig)) {
$instructions = << [
- 'lucentdb' => [
+ '$databaseConnectionName' => [
'driver' => 'sqlite',
'url' => env('LUCENT_DATABASE_URL'),
'database' => env('LUCENT_DB_DATABASE', database_path('database.sqlite')),
@@ -39,8 +36,8 @@ EOD;
}
try {
- DB::connection("lucentdb")->table("records")->get();
- }catch (QueryException $e) {
+ Database::make()->table("records")->get();
+ } catch (QueryException $e) {
$instructions = <<