laravel 4 -> get column names
问题 How to get column names of a table in an array or object in Laravel 4 , using Schema, DB, or Eloquent. It seems that I can't find a ready to use function, maybe you have some custom implementations. Thx. 回答1: New Answer At the time I gave this answer Laravel hadn't a way to do this directly , but now you can just: $columns = Schema::getColumnListing('users'); Old Answer Using attributes won't work because if you do $model = new ModelName; You have no attributes set to that model and you'll