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

Update Model.php for nested relations #53

Merged
merged 1 commit into from
Aug 24, 2021
Merged

Update Model.php for nested relations #53

merged 1 commit into from
Aug 24, 2021

Conversation

Geovanek
Copy link
Contributor

@Geovanek Geovanek commented Aug 24, 2021

Updated model.php so that the relationSearch() method works with polymorphic relationships, and for a nested relationship.

For nested relations, in the relationSearch(), use:

public function relationSearch(): array
{
    return [
        'kitchen' => [ // relationship on dishes model
            'name', // column enabled to search
        ],
        'post' => [ //relationship on dishes model
            'category' => [ // relationship on nested model
                'name', // column enabled to search on nested model
            ],
        ],
        // ... others
    ];
}

Updated model.php so that the searchRelation() method works with polymorphic relationships, and for a nested relationship.
@luanfreitasdev luanfreitasdev merged commit e12d746 into Power-Components:main Aug 24, 2021
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