Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.6] Check UPDATED_AT column existence in HasOneOrMany::update() #23747

Merged
merged 1 commit into from
Mar 30, 2018
Merged

[5.6] Check UPDATED_AT column existence in HasOneOrMany::update() #23747

merged 1 commit into from
Mar 30, 2018

Conversation

staudenmeir
Copy link
Contributor

Running an update query on an HasOne/HasMany relationship fails if the related model uses timestamps, but doesn't have an UPDATED_AT column:

class Bug extends Eloquent {
    const UPDATED_AT = null;
}

class Foo extends Eloquent {
    public function bugs() {
        return $this->hasMany(Bug::class);
    }
}

$foo->bugs()->update(['test' => 'bar']);

This PR checks whether the UPDATED_AT column exists before updating it.

Fixes #23741.

@taylorotwell taylorotwell merged commit 707d669 into laravel:5.6 Mar 30, 2018
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.

None yet

2 participants