Posts Learn Components Snippets Categories Tags Tools About

Set Default Timestamp in Laravel Migration

Learn how to set the default timestamp in Laravel migration to auto assign the current timestamp

Created on Aug 02, 2021


When writing a migration file, you can set the default value for the timestamp column type. The options are available using the "useCurrent()" method and the value will be set as CURRENT_TIMESTAMP as the default value.

Schema::create('posts', function (Blueprint $table) {

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for Set Default Timestamp in Laravel Migration


PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components

Sponsors 👑

+ Add Yours