TextColumn vanishes when using dot notation

So I've got this TextColumn component in a table
Tables\Columns\TextColumn::make('client.website')
->label('Website')
->formatStateUsing(fn (string $state) => Str::remove('https://', $state))
->url(function (string $state) {
if(Str::startsWith($state, ['https://', 'http://'])) {
return $state;
}
return 'https://'.$state;
}, true)
->toggleable()
->searchable(),
Tables\Columns\TextColumn::make('client.website')
->label('Website')
->formatStateUsing(fn (string $state) => Str::remove('https://', $state))
->url(function (string $state) {
if(Str::startsWith($state, ['https://', 'http://'])) {
return $state;
}
return 'https://'.$state;
}, true)
->toggleable()
->searchable(),
And if I just name it website it shows up but is empty (as my model doesn't have a website field, so that's as expected) When I name it client.website, it just disappears as if the column isn't defined at all. It also isn't shown in the column picker. The relationship defined on my model is like this:
public function client()
{
return $this->belongsTo(Client::class);
}
public function client()
{
return $this->belongsTo(Client::class);
}
This used to work, like 2 days ago, but now it doesn't. I've got no idea why this'd be the case. Last thing I did that could influence the query for the table is this:
->modifyQueryUsing(function (Builder $query) {
if (!request()->user()->hasRole('Super Admin')) {
return $query->where('assigned_to', request()->user()->id);
}
return $query;
})
->modifyQueryUsing(function (Builder $query) {
if (!request()->user()->hasRole('Super Admin')) {
return $query->where('assigned_to', request()->user()->id);
}
return $query;
})
But removing it doesn't return the column at all.
Solution:
@Sauravisus Hi! This might have been caused by a patch I had done in 3.1.4 in Advanced Tables to fix something else which introduced this error. I fixed this last night. Assuming you’re using it on this resource, update composer and bring down 3.2.5 and if it’s related to that then it will be fixed.
Jump to solution
5 Replies
Sauravisus
SauravisusOP14mo ago
I tried working around this, by making a new column and then loading in the data in another manner, but uh, that resulted in the url part working, but no text being displayed, even if I did formatStateUsing()
Solution
Kenneth Sese
Kenneth Sese14mo ago
@Sauravisus Hi! This might have been caused by a patch I had done in 3.1.4 in Advanced Tables to fix something else which introduced this error. I fixed this last night. Assuming you’re using it on this resource, update composer and bring down 3.2.5 and if it’s related to that then it will be fixed.
Sauravisus
SauravisusOP14mo ago
It might be, as it was working a few days ago. 😂 Hah, it was. Grabbing 3.2.4 with composer update fix'd the issue. 😄 Thanks @archilex!
Kenneth Sese
Kenneth Sese14mo ago
Awesome. Sorry about that!
Sauravisus
SauravisusOP14mo ago
No worries, man. I'm just glad it isn't me going bonkers. 😂
Want results from more Discord servers?
Add your server