Laravel-Backpack / activity-log

MIT License
23 stars 6 forks source link

[Bug] Error when using Subject filter #4

Closed tabacitu closed 1 year ago

tabacitu commented 1 year ago

Bug report

CleanShot 2022-12-06 at 10 47 21

What I did

What I expected to happen

A filtered list of those that include the keyword.

What happened

Big ass Livewire error.

What I've already tried to fix it

george-costanza-seinfeld-gif

promatik commented 1 year ago

I should have though about this one 👌

I think this happens because I'm guessing the name of the entity, using $model->identifiableAttribute(). And probably, the attribute is not being guessed, and is falling back to name that doesn't exists ...

@tabacitu, can you just confirm what's that entity identifiable attribute? and maybe confirm that $model->identifiableAttribute() doesn't work?

pxpm commented 1 year ago

I should have though about this one 👌

I think this happens because I'm guessing the name of the entity, using $model->identifiableAttribute(). And probably, the attribute is not being guessed, and is falling back to name that doesn't exists ...

@tabacitu, can you just confirm what's that entity identifiable attribute? and maybe confirm that $model->identifiableAttribute() doesn't work?

AFAIK, identifiableAttribute() will never return an attribute that does not exist. It will bail out with "the first found column" (ususally id if we can't find any other).

promatik commented 1 year ago

I was able to reproduce this one 🙌 And it's finally fixed with https://github.com/Laravel-Backpack/activity-log/pull/8 👌