What is Column Modifiers in laravel. What are the use of column modifiers. laravel migration tutorials.
Laravel migration column modifiers
When you add a table column in laravel thorw migration, there are multiple modifiers available Like after(), nullavle() and many others.
Laravel common use column modifiers
->after('column') ->comment('my comment') ->default($value) ->autoIncrement() ->charset('utf8mb4') ->invisible() ->nullable($value = true) ->unsigned() ->useCurrent() ->useCurrentOnUpdate() ->always() ->isGeometry() ->virtualAs($expression) ->generatedAs($expression)
Use column modifiers
after('column') create column after given column
comment('my comment') add a comment on column
default($value) set default column value
autoIncrement() make auto increment column
charset('utf8mb4') Define a character set of MySql column
invisible() remove column from select query
nullable($value = true) make column nullable
unsigned() set integer column as unsigned
useCurrent() use current timestamp as default value
useCurrentOnUpdate() use current timestamp when MySql record update