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

Relation columns of *-to-one relationship not displayed correctly #2719

Closed
zachgarwood opened this issue Jan 30, 2025 · 1 comment · May be fixed by #2720
Closed

Relation columns of *-to-one relationship not displayed correctly #2719

zachgarwood opened this issue Jan 30, 2025 · 1 comment · May be fixed by #2720

Comments

@zachgarwood
Copy link
Contributor

Description

When adding a Relation column of a *-to-one relationship (for example, BelongsTo or HasOne), the value is not shown. Instead, a series of commas is displayed.

Steps to reproduce

Create a controller for a model with a BelongsTo relationship. In the additionalIndexTableColumns() method, add a Relation column for the related model's field:

use A17\Twill\Services\Listings\Columns\Relation;
use A17\Twill\Services\Listings\TableColumns;

protected function additionalIndexTableColumns(): TableColumns
{
        $columns = TableColumns::make();
        $columns->add(
            Relation::make()
                ->field('title')
                ->title('Grouping')
                ->relation('grouping')
        );
        

        return $columns;
}

Expected result

I expect it to display the value of the field of the related model.

Actual result

A series of commas is displayed instead. See the "Grouping" column in this image for an example:
Image

Versions

Twill version: 3.4.1
Laravel version: v10.19.0
PHP version: 8.31

@zachgarwood
Copy link
Contributor Author

It looks like this is a duplicate of #2682

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 a pull request may close this issue.

1 participant