im still new to this laravel framework,so i was having this issue where i’m unable to update column “updated_at” which are automatically created by laravel migration. i want to change the value to the current time when i press a button. i have tried multiple ways from similiar questions but it doesn’t seem to work, like : using ‘->update()’,’->save()’,or ‘->touch()’.
syntax to update in Controller
$check = DB::table('queueTable')->where('category',$catName2)->where('status','Active')->where('skipped','0')->whereDate('created_at','=',now())->orderBy('queue','ASC')->limit(1);
$counter = DB::table('queueTable')->where('category',$catName2)->where('status','Inactive')->whereDate('created_at','=',now())->count();
DB::table('CurrentQueue')->where('id', 2)->update(['DoneQueue' => $counter+1]);
$check->update(['status' => 'Inactive']);
$check->update(['updated_at' => now()->format('Y-m-d H:i:s')]);
my migration
Schema::create('queueTable', function (Blueprint $table) {
$table->id();
$table->string('category');
$table->integer('queue')->default('0');
$table->string('status');
$table->integer('skipped')->default('0');
$table->timestamps();
});
it’d be much appreciated if someone could kindly explain where i’m going wrong.
Thanks in advance.
i want to update the value of “updated_at” to current time when i press a button