How to get database field type in Laravel?

后端 未结 9 2103
离开以前
离开以前 2020-12-14 01:38

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

9条回答
  •  旧巷少年郎
    2020-12-14 02:28

    Use this expression with a dial-down function to show you array details of all your table's fields:

    dd(DB::select(DB::raw('SHOW FIELDS FROM tablename')));
    

提交回复
热议问题