Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel add timestamps to existing table

$table->dateTime('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
$table->dateTime('updated_at')->nullable();
Comment

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'))
]);
Comment

PREVIOUS NEXT
Code Example
Php :: php convert special characters to unicode 
Php :: Magento 2 -Limit the length of the product name on the front end. 
Php :: HTML Snippets not working in .php files 
Php :: php ini_set timeout 
Php :: wordpress get text of wordpress post 
Php :: update json file php 
Php :: if any error in blade laravel 
Php :: php support block-level scope 
Php :: add column in existing table in laravel 
Php :: proper permission webserver laravel 
Php :: php repeat string 
Php :: integer nullable laravel 
Php :: How to get only year, month and day from timestamp in Laravel 
Php :: php add one day to date 
Php :: laravel where condition on relationship 
Php :: run python script from batch file with arguments 
Php :: php sort array by key 
Php :: file_put_contents php json file 
Php :: laravel 8 check if null or empty 
Php :: laravel get file contents from storage 
Php :: form validation with larvel api 
Php :: laravel orderby with relation 
Php :: php get array key by value multidimensional 
Php :: carbon random future date 
Php :: how to run php file in xampp 
Php :: How to install a specific version of package using Composer? 
Php :: how to create a logout button in wordpress 
Php :: php convert minutes to hours and minutes 
Php :: Laravel 9 Clear Cache of Route, View, Config, Event Commands 
Php :: absolute path php 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =