Skip to content

[13.x] Fix restore() failing on soft delete queries with joins - #61998

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:soft-delete-restore-with-joins
Oct 14, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:soft-delete-restore-with-joins

Conversation

@xurshudyan

Copy link
Copy Markdown
Contributor

restore() fails on MySQL when the query has a join to another table that also has a deleted_at column, for example a hasManyThrough relation where both models use SoftDeletes:

$team->posts()->delete(); // works

$team->posts()->onlyTrashed()->restore();
// SQLSTATE[23000]: 1052 Column 'deleted_at' in field list is ambiguous

@taylorotwell
taylorotwell merged commit ce7a0de into laravel:13.x Oct 14, 2026
64 checks passed
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.

2 participants