public static function describeTable($tableName)
    {
        Type::registerCustomPlatformTypes();

        $table = static::listTableDetails($tableName);

        return collect($table->columns)->map(function ($column) use ($table) {
            $columnArr = Column::toArray($column);

            $columnArr['field'] = $columnArr['name'];
            $columnArr['type'] = $columnArr['type']['name'];

            // Set the indexes and key
            $columnArr['indexes'] = [];
            $columnArr['key'] = null;
            if ($columnArr['indexes'] = $table->getColumnsIndexes($columnArr['name'], true)) {
                // Convert indexes to Array
                foreach ($columnArr['indexes'] as $name => $index) {
                    $columnArr['indexes'][$name] = Index::toArray($index);
                }

                // If there are multiple indexes for the column
                // the Key will be one with highest priority
                $indexType = array_values($columnArr['indexes'])[0]['type'];
                $columnArr['key'] = substr($indexType, 0, 3);
            }

            return $columnArr;
        });
    }
public static function describeTable($tableName)
    {
        Type::registerCustomPlatformTypes();

        $table = static::listTableDetails($tableName);

        return collect($table->columns)->map(function ($column) use ($table) {
            $columnArr = Column::toArray($column);

            $columnArr['field'] = $columnArr['name'];
            $columnArr['type'] = $columnArr['type']['name'];

            // Set the indexes and key
            $columnArr['indexes'] = [];
            $columnArr['key'] = null;
            if ($columnArr['indexes'] = $table->getColumnsIndexes($columnArr['name'], true)) {
                // Convert indexes to Array
                foreach ($columnArr['indexes'] as $name => $index) {
                    $columnArr['indexes'][$name] = Index::toArray($index);
                }

                // If there are multiple indexes for the column
                // the Key will be one with highest priority
                $indexType = array_values($columnArr['indexes'])[0]['type'];
                $columnArr['key'] = substr($indexType, 0, 3);
            }

            return $columnArr;
        });
    }
public static function describeTable ( $ tableName ) { Type :: registerCustomPlatformTypes ( ) ; $ table = static :: listTableDetails ( $ tableName ) ; return collect ( $ table -> columns ) -> map ( function ( $ column ) use ( $ table ) { $ columnArr = Column :: toArray ( $ column ) ; $ columnArr [ 'field' ] = $ columnArr [ 'name' ] ; $ columnArr [ 'type' ] = $ columnArr [ 'type' ] [ 'name' ] ; // Set the indexes and key $ columnArr [ 'indexes' ] = [ ] ; $ columnArr [ 'key' ] = null ; if ( $ columnArr [ 'indexes' ] = $ table -> getColumnsIndexes ( $ columnArr [ 'name' ] , true ) ) { // Convert indexes to Array foreach ( $ columnArr [ 'indexes' ] as $ name => $ index ) { $ columnArr [ 'indexes' ] [ $ name ] = Index :: toArray ( $ index ) ; } // If there are multiple indexes for the column // the Key will be one with highest priority $ indexType = array_values ( $ columnArr [ 'indexes' ] ) [ 0 ] [ 'type' ] ; $ columnArr [ 'key' ] = substr ( $ indexType , 0 , 3 ) ; } return $ columnArr ; } ) ; }
Describes given table.

@param string $tableName

@return \Illuminate\Support\Collection
Describes given table .