Skip to content

Commit

Permalink
Multi DB connection support
Browse files Browse the repository at this point in the history
  • Loading branch information
Advaith3600 committed Sep 19, 2023
1 parent 07fa023 commit 857c235
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"license": "MIT",
"devDependencies": {
"autoprefixer": "^10.4.4",
"laravel-mix": "^6.0.43",
"laravel-mix": "^6.0.49",
"postcss": "^8.4.12",
"resolve-url-loader": "^5.0.0",
"sass": "^1.67.0",
Expand Down
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: [
require('tailwindcss'),
require('autoprefixer'),
]
}
22 changes: 15 additions & 7 deletions src/ModelResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ class_uses_recursive($className),
private function registerModels(string $path): void
{
// caching the models
$this->models = Cache::remember(
$this->getCacheKey(),
now()->addDay(),
fn () => $this->extractFromFolder($path)
);
$this->models = app()->environment('production') ?
Cache::remember(
$this->getCacheKey(),
now()->addDay(),
fn () => $this->extractFromFolder($path)
) :
$this->extractFromFolder($path);
}

public function getCacheKey(): string
Expand Down Expand Up @@ -192,7 +194,10 @@ public function getColumns(string $type): array
SELECT
COLUMN_NAME AS field,
COLUMN_TYPE AS type,
IS_NULLABLE AS is_null
CASE
WHEN IS_NULLABLE = 'YES' THEN 1
ELSE 0
END AS is_null
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = '$table' AND
Expand All @@ -204,7 +209,10 @@ public function getColumns(string $type): array
SELECT
c.column_name AS field,
c.udt_name AS type,
c.is_nullable AS is_null
CASE
WHEN c.is_nullable = 'YES' THEN TRUE
ELSE FALSE
END AS is_null
FROM information_schema.columns c
LEFT JOIN
pg_attribute attr ON attr.attrelid = '$table'::regclass AND attr.attname = c.column_name AND attr.atthasdef
Expand Down
2 changes: 1 addition & 1 deletion src/resources/assets/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/resources/assets/js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/resources/assets/js/foreign-selection.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/resources/assets/js/type-index.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/resources/assets/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{}
{
"/js/app.js": "/js/app.js",
"/js/type-index.js": "/js/type-index.js",
"/js/foreign-selection.js": "/js/foreign-selection.js",
"/css/app.css": "/css/app.css"
}

0 comments on commit 857c235

Please sign in to comment.