Reputation: 31
Hello I'm new in code and I try to change the name columun of created_at and updated_at in User table.
I see other tuto and he write in model : Change name of Laravel's created_at and updated_at
const CREATED_AT = 'post_date';
const UPDATED_AT = 'post_modified';
But for me in User model I write :
class User extends Authenticatable
{
use Uuid;
use HasApiTokens,HasFactory, Notifiable;
const CREATED_AT = 'registered_on';
const UPDATED_AT = 'modify_on';
}
But when I try the migration the column 'created_at' is here and no the 'registered_on'. Any ideas ?
Upvotes: 0
Views: 1294
Reputation: 5030
you have just changed the model's column name.
you have to change the migrations too:
remove the ->timestamps()
and add the registered_on
& modify_on
column, like below:
$table->timestamp('registered_on');
$table->timestamp('modify_on');
Note: to remove function is timestamps()
with s
Then run:
php artisan migrate:refresh
to rebuild all of the tables
Upvotes: 3