1

I changed the column name from 'updated_at' to 'last_updated_at' in the laravel 'users' table used for authentication.

Now I get this error during registration:

SQLSTATE[HY000]: General error: 1 table accounts has no column named updated_at (SQL: insert into "accounts" ("username", "email_addr", "password", "updated_at", "created_at") values (...))

How do I make it use the new column name?

Savvy Sage
  • 347
  • 1
  • 4
  • 12

2 Answers2

10

If you want to handle the field automatically and not let Laravel automatically manage created_at and updated_at fields, you need to set

public $timestamps = false

in your model.

If you want laravel to still manage it but keeping the new name, set

const UPDATED_AT = 'last_updated_at';

in your model

gbalduzzi
  • 9,356
  • 28
  • 58
1

You can override the updated_at column name by adding this to your User model.

class User extends Authenticatable
{
    const UPDATED_AT = 'last_updated_at';
}
Robin Reiter
  • 2,281
  • 15
  • 24