1010use builder \Database \Migrations \Schema ;
1111use builder \Database \Migrations \Migration ;
1212
13- if (! function_exists ('isConnection ' )) {
13+ if (! function_exists ('isDatabaseConnectionDefined ' )) {
1414 /**
15- * Get Database Connection Status
15+ * Get Database Connection Constant Status
16+ * - When You connecto to Database using autoload or -- Direct connection
17+ * A Global Constant is Instantly defined for us.
18+ * This is to check if it has been defined or not
1619 *
17- * @return bool\builder\Database\isConnection
20+ * @return bool\builder\Database\isDatabaseConnectionDefined
1821 */
19- function isConnection ()
22+ function isDatabaseConnectionDefined ()
2023 {
21- return (new MySqlExec )->isConnection ();
24+ return (new MySqlExec )->isDatabaseConnectionDefined ();
2225 }
2326}
2427
@@ -46,7 +49,7 @@ function db(?array $options = [])
4649 function db_query ()
4750 {
4851 // get query
49- return isConnection ()
52+ return isDatabaseConnectionDefined ()
5053 ? DATABASE_CONNECTION ->dbQuery ()
5154 : (new MySqlExec )->dbQuery ();
5255 }
@@ -66,7 +69,7 @@ function db_query()
6669 */
6770 function db_config (?array $ options = [])
6871 {
69- if ( ! isConnection () ) {
72+ if ( ! isDatabaseConnectionDefined () ) {
7073 define ('DATABASE_CONNECTION ' , db ($ options ));
7174 }
7275 }
@@ -84,7 +87,7 @@ function db_config(?array $options = [])
8487 function db_connection (?string $ type = null )
8588 {
8689 // get database connection
87- $ connection = isConnection ()
90+ $ connection = isDatabaseConnectionDefined ()
8891 ? DATABASE_CONNECTION ->dbConnection ()
8992 : db ()->dbConnection ();
9093
@@ -98,10 +101,10 @@ function db_connection(?string $type = null)
98101 *
99102 * @return mixed\builder\Database\getDriver
100103 */
101- function driver ()
104+ function db_driver ()
102105 {
103106 // get database connection
104- return isConnection ()
107+ return isDatabaseConnectionDefined ()
105108 ? DATABASE_CONNECTION ->dbConnection ()['driver ' ]
106109 : db ()->dbConnection ()['driver ' ];
107110 }
@@ -333,7 +336,7 @@ function app_data()
333336 : env_orm ()->getDirectory ();
334337
335338 // get database
336- $ database = isConnection ()
339+ $ database = isDatabaseConnectionDefined ()
337340 ? DATABASE_CONNECTION
338341 : db ();
339342
0 commit comments