Answers for "laravel DB get column name"

SQL
1

get table column names sql laravel

use IlluminateSupportFacadesSchema;

use IlluminateSupportFacadesDB;

public function getTableColumns($table)
{
    return DB::getSchemaBuilder()->getColumnListing($table);

    // OR

    return Schema::getColumnListing($table);

}
Posted by: Guest on December-05-2020
0

laravel get column field name

// You may need to run
composer require doctrine/dbal
// Retrieve laravel column type
$columnType = DB::getSchemaBuilder()->getColumnType($tableName, $colName)
// for example
$columnType = DB::getSchemaBuilder()->getColumnType('user', 'age')
Posted by: Guest on November-02-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language