Skip to content

Conversation

@marickvantuil
Copy link
Contributor

In a hasOneThrough/hasManyThrough relation, it would not apply an alias to the related table.

class Comment # 1: farParent
{
    public function postCategory(): HasOneThrough
    {
                                  # 2: related       3: through
        return $this->hasOneThrough(Category::class, Post::class);
    }
}

Instead, it would look for a potential alias of the 'farParent' but I think this is unintentional. It should look for alias in the 'through' relation (it already did that) and the 'related' relation (it does after this change)

Second fix is for #209 and applies missing alias in soft deletes for morphOne/morphMany.

PS, i added a new Like model because I need to test soft deletes. I didn't want to add SoftDeletes to another model because it would mean many existing tests needed to be changed.

@marickvantuil
Copy link
Contributor Author

Happy to help with any additional work needed to get this merged. If more tests are necessary let me know.

@luisdalmolin
Copy link
Member

Great, thanks for the additional tests making sure things work. I'll get this reviewed but I think this change makes sense.

@luisdalmolin luisdalmolin merged commit 4a8012c into kirschbaum-development:master May 19, 2025
19 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