public static function showTables($prefix)
    {
        $results = static::select('SHOW FULL TABLES');

        $tables = [];
        $views = [];
        $first = '';
        foreach ($results as $result) {
            // get the first element (table name)
            foreach ($result as $value) {
                $first = $value;
                break;
            }

            // skip all tables that are not the current prefix
            if (!empty($prefix)) {
                if (!starts_with($first, $prefix)) {
                    continue;
                }
            }

            // separate views from tables
            if ($result->Table_type == 'VIEW') {
                $views[] = $first;
            } else {
                $tables[] = $first;
            }
        }

        return ['tables' => $tables, 'views' => $views];
    }
public static function showTables($prefix)
    {
        $results = static::select('SHOW FULL TABLES');

        $tables = [];
        $views = [];
        $first = '';
        foreach ($results as $result) {
            // get the first element (table name)
            foreach ($result as $value) {
                $first = $value;
                break;
            }

            // skip all tables that are not the current prefix
            if (!empty($prefix)) {
                if (!starts_with($first, $prefix)) {
                    continue;
                }
            }

            // separate views from tables
            if ($result->Table_type == 'VIEW') {
                $views[] = $first;
            } else {
                $tables[] = $first;
            }
        }

        return ['tables' => $tables, 'views' => $views];
    }
public static function showTables ( $ prefix ) { $ results = static :: select ( 'SHOW FULL TABLES' ) ; $ tables = [ ] ; $ views = [ ] ; $ first = '' ; foreach ( $ results as $ result ) { // get the first element (table name) foreach ( $ result as $ value ) { $ first = $ value ; break ; } // skip all tables that are not the current prefix if ( ! empty ( $ prefix ) ) { if ( ! starts_with ( $ first , $ prefix ) ) { continue ; } } // separate views from tables if ( $ result -> Table_type == 'VIEW' ) { $ views [ ] = $ first ; } else { $ tables [ ] = $ first ; } } return [ 'tables' => $ tables , 'views' => $ views ] ; }
Execute a SHOW TABLES query.

@return array with 'tables' and 'views'
Execute a SHOW TABLES query .