Home > Enterprise >  how to make date & time inputs dynamic
how to make date & time inputs dynamic

Time:04-16

i've form has 2 inputs date/time but its static i have an idea but don't know if its applicable or not.

i want the 2 inputs have default now();

if the didn't change its value it stored to db with the now(); date and time,

but if he changed it to another date and time the stored value be his choice,

is this can be done ?

CodePudding user response:

use laravel helper function

now()

also you have use carbon class:

Carbon\Carbon::now()

this is an example:

  $data = array("name" => $name,"address" => $address,"created_at"=> Carbon::now(),"updated_at"=> now());
DB::table('student')->insert($data);
  • Related