Skip to content

Conversation

@antonkomarev
Copy link
Contributor

Related to: #20901 and #19627 (comment)

Adds ability to define if model has no updated_at column.

If $withoutUpdatedAt property exists and true - skip handling of updated_at column updates.

ModelWithoutUpdatedAt extends Model
{
    public $withoutUpdatedAt = true;
}

@taylorotwell
Copy link
Member

No plans to allow only 1 timestamp.

@antonkomarev antonkomarev deleted the feature/without-updated-at branch September 2, 2017 11:35
@antonkomarev
Copy link
Contributor Author

Is there any reason of it? Could this question be a bit more illuminated to let people know why they'd better prefer to have updated_at columns in all their models? Thanks.

@BrandonSurowiec
Copy link
Contributor

BrandonSurowiec commented Sep 3, 2017

@a-komarev In one of my legacy projects that I was converting to Laravel I made the model only use the created at timestamp by adding:

    /**
     * The name of the "updated at" column.
     *
     * @var string
     */
    const UPDATED_AT = null;

Into my model. I'm sure if you switch that to const CREATED_AT = null; you can get the behavior you desire.

(Edit: I just noticed the PR you mentioned that broke it. ) Looks like you figured out a nice workaround by using a mutator to make setCreatedAtAttribute do nothing. #20901 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants