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

Fix related column name in the fill method #5649

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NikolayMurha
Copy link
Contributor

Hello.

I found problem with hasOne relation with snakeCased method.

For example, when I have class like this:

class CartItem {
    public function productVariant() {
        return $this->belongsTo(ProductVariant::class);
    }
}

And grid like this

$cartItemsGrid->column('productVariant', 'Product Variant')->display(function ($row) {
    return $row;
});

I have an empty row because the loaded field has the name product_variant but column name like relation method - productVariant.

When I used product_variant for relation, related data didn't load, because the relation method name does not matched:

$cartItemsGrid->column('product_variant', 'Product Variant')->display(function ($row) {
    return $row;
});

My solution in this PR.

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

1 participant