F
Filament13mo ago
Fogzy

SpatieTagsColumn pluck() on null after update

I'm using these versions: - spatie/laravel-tags (4.5.1) - filament/spatie-laravel-tags-plugin (v3.0.73) And everything works fine. When I tried updating v3.0.73 => v3.0.101, I run into an issue with the list view (form works fine). This is the code.
SpatieTagsColumn::make('tags')->sortable()->searchable(
true, function (Builder $query, string $search) {
$query->whereHas(
relation: 'tags',
callback: fn (Builder $q) => $q->where('name', 'like', "%{$search}%")
);
}),
SpatieTagsColumn::make('tags')->sortable()->searchable(
true, function (Builder $query, string $search) {
$query->whereHas(
relation: 'tags',
callback: fn (Builder $q) => $q->where('name', 'like', "%{$search}%")
);
}),
I get pluck() on null error. Any ideas what could be the problem?
5 Replies
Fogzy
FogzyOP11mo ago
@Dan Harrin Dan, I'm sorry I have to tag you, I currently tried updating again and still have this error. Do you have any idea how to solve this? So I removed this:
protected $casts = [
'tags' => 'array',
];
protected $casts = [
'tags' => 'array',
];
And got it working again.
Matthew
Matthew11mo ago
Please dont tag Dan for questions 😅 He doesnt like it xd
Fogzy
FogzyOP11mo ago
yeah that’s understandable
Dan Harrin
Dan Harrin11mo ago
is there anything wrong with this? the reason why it breaks is because Laravel assumes its an attribute and not a relationship if a cast exists
Fogzy
FogzyOP11mo ago
I think it's OK, just thought that since it worked before the update, it has to be something with the Spatie Tags plugin. Thanks for your time.
Want results from more Discord servers?
Add your server