public static function getModelColumns(string $model = '', string $connectionManager = 'default'): array
    {
        $result = $columns = [];

        if (empty($model)) {
            return $result;
        }

        // making sure that model is in table naming conventions.
        $model = Inflector::tableize($model);

        try {
            $connection = ConnectionManager::get($connectionManager);
            $schema = $connection->getSchemaCollection();
            $table = $schema->describe($model);
            $columns = $table->columns();
        } catch (MissingDatasourceConfigException $e) {
            return $result;
        } catch (Exception $e) {
            return $result;
        }

        // A table with no columns?
        if (empty($columns)) {
            return $result;
        }

        foreach ($columns as $column) {
            $result[$column] = $column;
        }

        return $result;
    }
public static function getModelColumns(string $model = '', string $connectionManager = 'default'): array
    {
        $result = $columns = [];

        if (empty($model)) {
            return $result;
        }

        // making sure that model is in table naming conventions.
        $model = Inflector::tableize($model);

        try {
            $connection = ConnectionManager::get($connectionManager);
            $schema = $connection->getSchemaCollection();
            $table = $schema->describe($model);
            $columns = $table->columns();
        } catch (MissingDatasourceConfigException $e) {
            return $result;
        } catch (Exception $e) {
            return $result;
        }

        // A table with no columns?
        if (empty($columns)) {
            return $result;
        }

        foreach ($columns as $column) {
            $result[$column] = $column;
        }

        return $result;
    }
public static function getModelColumns ( string $ model = '' , string $ connectionManager = 'default' ) : array { $ result = $ columns = [ ] ; if ( empty ( $ model ) ) { return $ result ; } // making sure that model is in table naming conventions. $ model = Inflector :: tableize ( $ model ) ; try { $ connection = ConnectionManager :: get ( $ connectionManager ) ; $ schema = $ connection -> getSchemaCollection ( ) ; $ table = $ schema -> describe ( $ model ) ; $ columns = $ table -> columns ( ) ; } catch ( MissingDatasourceConfigException $ e ) { return $ result ; } catch ( Exception $ e ) { return $ result ; } // A table with no columns? if ( empty ( $ columns ) ) { return $ result ; } foreach ( $ columns as $ column ) { $ result [ $ column ] = $ column ; } return $ result ; }
Get Model Columns

@param string $model name of the table
@param string $connectionManager of the datasource

@return mixed[] $result containing key/value pairs of model columns.
Get Model Columns