Fetch the column names from a model.

Submitted by orlissenberg - 4 years ago

Lists the columns on a table.

$columns = \Schema::connection('databaseName')->getColumnListing('tableName');

$columns = ExampleEloquentModel::getModel()->getConnection()->getSchemaBuilder()->getColumnListing(ExampleEloquentModel::getModel()->getTable());

comments powered by Disqus