src/Traits/Database/DBTrait.php
public function getDefaultDb(): ?ConnectionInterface
    {
        // By default, the DB Facade does not return the
        // any actual database connection, but rather an
        // instance of \Illuminate\Database\DatabaseManager.
        // Therefore, we make sure only to obtain its
        // "connection", to make sure that its only the connection
        // instance that we obtain.
        $manager = DB::getFacadeRoot();
        if (isset($manager)) {
            return $manager->connection();
        }
        return $manager;
    }
public function getDefaultDb(): ?ConnectionInterface
    {
        // By default, the DB Facade does not return the
        // any actual database connection, but rather an
        // instance of \Illuminate\Database\DatabaseManager.
        // Therefore, we make sure only to obtain its
        // "connection", to make sure that its only the connection
        // instance that we obtain.
        $manager = DB::getFacadeRoot();
        if (isset($manager)) {
            return $manager->connection();
        }
        return $manager;
    }
public function getDefaultDb ( ) : ? ConnectionInterface { // By default, the DB Facade does not return the // any actual database connection, but rather an // instance of \Illuminate\Database\DatabaseManager. // Therefore, we make sure only to obtain its // "connection", to make sure that its only the connection // instance that we obtain. $ manager = DB :: getFacadeRoot ( ) ; if ( isset ( $ manager ) ) { return $ manager -> connection ( ) ; } return $ manager ; }
Get a default db value, if any is available

@return ConnectionInterface|null A default db value or Null if no default value is available
Get a default db value if any is available