Laravel

Tip: Default current timestamp to Laravel migration

Quick tip of the day, how to add default datetime to migration.

$table->timestamp('some_date_at')->default(DB::raw('CURRENT_TIMESTAMP'));

About the author

Danyal

I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.

View all posts