<?php Schema::create('posts', function (Blueprint $table) { $table->timestamp('published_at')->useCurrent(); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent(); });
Set Default Timestamp in Laravel Migration
187
3 years ago
0 comments
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.
Topics:
Frontend
Resource
Average
Average
Support Us
If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️
Leave a reply