Column relationship

hello i wanted to show the domainextension price! but i think i got something wrong 😦

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('domain')->searchable(),
                Tables\Columns\BadgeColumn::make('domain_status')
                    ->colors([
                        'success' => static fn ($status): bool => strpos(strtolower($status), 'vrij') !== false,
                        'danger' => static fn ($status): bool => strpos(strtolower($status), 'bezet') !== false,
                    ]),
                Tables\Columns\TextColumn::make('domainextension.price'),
            ])


domainExtension Model:
public function domaincheckrecord()
    {
        return $this->hasMany(DomainCheckRecord::class);
    }

DomainCheckRecord model:
    public function domainextension():belongsTo
    {
        return $this->belongsTo(DomainExtension::class);
    }
Solution
Fixed it! just needed to add the foreignkey in the domainextension():belongsTo
Was this page helpful?