diff --git a/CHANGELOG.md b/CHANGELOG.md index b10206a..ee93df8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.2.2 - 2020-11-05 +### Add +- Add configuration parameters (config/lara-lens.php) for managing webview: LARALENS_PREFIX, LARALENS_MIDDLEWARE, LARALENS_WEB_ENABLED, thanks to @yogendra-revanna, @JexPY, @Zuruckt; +- Initial support for PHP8-rc; + + + ## 0.2.1 - 2020-09-22 ### Add - Show available PHP extension via --show=php-ext option (thanks to https://github.com/yogendra-revanna); diff --git a/composer.json b/composer.json index 4137972..2a1baca 100755 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ "require": { "php": "^7.2|^8.0", "guzzlehttp/guzzle": "^6.0|^7.0", - "illuminate/support": "^6.0|^7.0|^8.0" + "illuminate/support": "^6.0|^7.0|^8.0", + "ext-json": "*" }, "require-dev": { "orchestra/testbench": "4.*|5.*|6.*", diff --git a/src/Lens/Traits/DatabaseLens.php b/src/Lens/Traits/DatabaseLens.php index 294465b..8f7e301 100644 --- a/src/Lens/Traits/DatabaseLens.php +++ b/src/Lens/Traits/DatabaseLens.php @@ -55,29 +55,33 @@ public function dbConnection() return $dbconnection; } - public function getDatabaseConnectionInfos(ConnectionInterface $dbconnection, ResultLens $results, $checkTable, $columnSorting) - { - $connectionName = $dbconnection->getName(); + public function getDatabaseConnectionInfos( + ConnectionInterface $dbConnection, + ResultLens $results, + $checkTable, + $columnSorting + ) { + $connectionName = $dbConnection->getName(); $results->add( "Connection name", $connectionName ); - $grammar = $dbconnection->getQueryGrammar(); + $grammar = $dbConnection->getQueryGrammar(); $results->add( "Query Grammar", Str::afterLast(get_class($grammar), '\\') ); - $driverName = $dbconnection->getDriverName(); + $driverName = $dbConnection->getDriverName(); $results->add( "Driver name", $driverName ); - $databaseName = $dbconnection->getDatabaseName(); + $databaseName = $dbConnection->getDatabaseName(); $results->add( "Database name", $databaseName ); - $tablePrefix = $dbconnection->getTablePrefix(); + $tablePrefix = $dbConnection->getTablePrefix(); $results->add( "Table prefix", $tablePrefix @@ -86,7 +90,7 @@ public function getDatabaseConnectionInfos(ConnectionInterface $dbconnection, Re $pdo = null; $pdoIsOk = false; try { - $pdo = $dbconnection->getPDO(); + $pdo = $dbConnection->getPDO(); $pdoIsOk = true; } catch (\PDOException $e) { $this->checksBag->addWarningAndHint( @@ -104,17 +108,10 @@ public function getDatabaseConnectionInfos(ConnectionInterface $dbconnection, Re "" ); } else { - /* - $this->checksBag->addWarningAndHint( - "Connection and PDO driver", - "Your DB doesn't support PDO driver (". $driverName. ").", - "" - ); - */ } } else { try { - $serverVersion = $dbconnection->getPDO()->getAttribute(\PDO::ATTR_SERVER_VERSION); + $serverVersion = $dbConnection->getPDO()->getAttribute(\PDO::ATTR_SERVER_VERSION); $results->add( "Server version", $serverVersion @@ -131,7 +128,7 @@ public function getDatabaseConnectionInfos(ConnectionInterface $dbconnection, Re } - $connectionType = $dbconnection->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME); + $connectionType = $dbConnection->getPDO()->getAttribute(\PDO::ATTR_DRIVER_NAME); $results->add( "Database connection type", $connectionType @@ -154,18 +151,21 @@ public function getDatabaseConnectionInfos(ConnectionInterface $dbconnection, Re $stringTables ); - $checkountMessage = ""; + $checkCountMessage = ""; + $checkCount = 0; try { - $checkcount = DB::table($checkTable) + $checkCount = DB::table($checkTable) ->select(DB::raw('*')) ->count(); } catch (\Exception $e) { - $checkcount = 0; - $checkountMessage = " - error with " . $checkTable . " table"; + $checkCount = 0; + $checkCountMessage = " - error with " . $checkTable . " table"; $results->addErrorAndHint( "Table Error", "Failed query, table <" . $checkTable . "> ", - "Make sure that table <" . $checkTable . "> exists, available tables : " . (($stringTables == "") ? "Not tables found" : $stringTables) + "Make sure that table <" . $checkTable . + "> exists, available tables : " . + (($stringTables == "") ? "Not tables found" : $stringTables) ); } @@ -175,9 +175,9 @@ public function getDatabaseConnectionInfos(ConnectionInterface $dbconnection, Re ); $results->add( "Number of rows", - $checkcount . $checkountMessage + $checkCount . $checkCountMessage ); - if ($checkcount > 0) { + if ($checkCount > 0) { try { $latest = DB::table($checkTable)->latest($columnSorting)->first(); $results->add( @@ -199,15 +199,15 @@ public function getDatabase($checkTable = "users", $columnSorting = "created_at" { $results = new ResultLens(); - $dbconnection = $this->dbConnection(); + $dbConnection = $this->dbConnection(); $results->add( "Database default", config("database.default") ); - if ($dbconnection) { - $this->getDatabaseConnectionInfos($dbconnection, $results, $checkTable, $columnSorting); + if ($dbConnection) { + $this->getDatabaseConnectionInfos($dbConnection, $results, $checkTable, $columnSorting); }