How Can I Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations?
Given it’s a raw expression, you should use DB::raw() to set CURRENT_TIMESTAMP as a default value for a column: $table->timestamp(‘created_at’)->default(DB::raw(‘CURRENT_TIMESTAMP’)); This works flawlessly on every database driver. As of Laravel 5.1.25 (see PR 10962 and commit 15c487fe) you can now use the new useCurrent() column modifier method to achieve the same default value for a … Read more