Answers for "laravel add another timestamp column to a model"

PHP
1

laravel add timestamps to existing table

$table->dateTime('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->dateTime('updated_at')->nullable();
Posted by: Guest on November-17-2020
0

insert timestamps manually in laravel

// if you would set local timezon otherwise skip this
$timezone = "Asia/Dhaka";
date_default_timezone_set($timezone);
// insert created_at value manually
DB::table('table')->insert([
	'key'=> 'value',
  	'created_at' => date("Y-m-d H:i:s", strtotime('now'))
]);
Posted by: Guest on December-02-2021

Code answers related to "laravel add another timestamp column to a model"

Browse Popular Code Answers by Language