Laravel: how to get table column name, type and length

Is there any method available in Laravel 5 / 5.1 with which we can get the name of a table column, its type and length, Metal data of a table table?

eg:

Name    |    Type    |    Length

ID      |    Integer |    11
Name    |    varchar |    100
Email   |    varchar |    100
Password|    md5     |    82
Address |    tinytext|    
DOB     |    date    |    
Status  |    enum(0,1)|
+4
source share
1 answer

You can check it out here. https://laravel.com/api/5.1/Illuminate/Database/Connection.html

Sample code to get the password field type from the user table.

dd(DB::connection()->getDoctrineColumn('users', 'password')->getType()->getName());

I will leave the rest to you. Goodluck :)

0
source

Source: https://habr.com/ru/post/1612892/


All Articles