I want get the columns properties(column type, charset etc.) from table in Eloquent orm. how i can did this?
Asked
Active
Viewed 159 times
0
-
1possible duplicate of [laravel 4 -> get column names](http://stackoverflow.com/questions/19951787/laravel-4-get-column-names) – Imran Jan 04 '15 at 16:36
1 Answers
0
I solved this:
DB::select(DB::raw('SHOW COLUMNS FROM users'));

engilexial
- 153
- 1
- 3
- 14
-
1this is the raw quey. you question was for elequent. After few minutes searching on stackoverflow I found a question http://stackoverflow.com/questions/18562684/how-to-get-database-field-type-in-laravel . Anyway [Describe Table](http://dev.mysql.com/doc/refman/4.1/en/describe.html) may more powrfull then `SHOW COLUMNS` – Imran Jan 04 '15 at 16:49
-
`DB::select` takes a raw query. No need to call `DB::raw` again. – Joseph Silber Jan 04 '15 at 17:31