Is there a way to get the datatype of a database table field? Almost like a inverse of migration.
For example, if the migration of a users table column looks like >
GET All Details of fields of table
DB::select('describe table_name');
Example:-
DB::select('describe users');
Response will be like this
Array
(
[0] => stdClass Object
(
[Field] => id
[Type] => int(11)
[Null] => NO
[Key] => PRI
[Default] =>
[Extra] => auto_increment
)
[1] => stdClass Object
(
[Field] => user_group_id
[Type] => int(11) unsigned
[Null] => YES
[Key] => MUL
[Default] =>
[Extra] =>
)
[2] => stdClass Object
(
[Field] => username
[Type] => varchar(100)
[Null] => YES
[Key] => MUL
[Default] =>
[Extra] =>
)
)