Laravel Migration Set Default Current Timestamp

[Solved] Laravel Migration Set Default Current Timestamp | Php - Code Explorer | yomemimo.com
Question : Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations

Answered by : clever-corncrake-tm5rnsrlus5r

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

Source : https://stackoverflow.com/questions/18067614/how-can-i-set-the-default-value-of-a-timestamp-column-to-the-current-timestamp-w | Last Update : Tue, 11 Aug 20

Question : on update current timestamp laravel migration

Answered by : tushar-saha-7scjp0835tdc

$table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));

Source : | Last Update : Fri, 12 Nov 21

Question : created_at default value laravel

Answered by : homeless-hawk-06ucc05781ye

$table->timestamp('created_at')->useCurrent();

Source : https://stackoverflow.com/questions/18067614/how-can-i-set-the-default-value-of-a-timestamp-column-to-the-current-timestamp-w | Last Update : Fri, 16 Oct 20

Answers related to laravel migration set default current timestamp

Code Explorer Popular Question For Php