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

Add support for MorphOne relationships #143

Open
wants to merge 1 commit into
base: L6
Choose a base branch
from

Conversation

JeremyDunn
Copy link

This PR adds support for sorting by a polymorphic MorphOne relationship. This change is pretty straight-forward as it only requires an extra condition to the join query.

Let me know if you have any questions or would like me to revise or add anything.

@JeremyDunn JeremyDunn requested a review from Kyslik February 22, 2020 19:22
@Kyslik
Copy link
Owner

Kyslik commented Mar 25, 2021

I need someone to verify this PR before it can go in.

@robbielove
Copy link

I rebased this branch onto the latest (I need to use PHP 8) and tried it but found that an error occurred when using the morphOne relation:

    public function subdomains(): MorphOne
    {
        return $this->morphOne('Example\Subdomain', 'subdomainable', 'subdomainable_type', 'subdomainable_id')->orderBy('created_at', 'desc')->withoutGlobalScopes();
    }

Screen Shot 2022-02-08 at 7 57 53 pm

https://github.com/robbielove/column-sortable/tree/morphone-support

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