How to get table column names from a database table in Eloquent?
October 26, 2018
There are a few methods to get the table column info in Eloquent
<?php
\Schema::getColumnListing($this->table)
<?php
class User extends Model {
public function getTableColumns() {
return $this
->getConnection()
->getSchemaBuilder()
->getColumnListing($this->getTable());
}
}