dimsav / laravel-translatable

[Deprecated] A Laravel package for multilingual models
MIT License
1.95k stars 320 forks source link

add isEmptyTranslatableAttribute() to allow custom decision logic #576

Closed Gummibeer closed 5 years ago

Gummibeer commented 5 years ago

fixes #393 fixes #543 fixes #573

Gummibeer commented 5 years ago

and this is how it looks if you don't want to run local CircleCI cli. 🙈 😂

dimsav commented 5 years ago

@Gummibeer I'm trying to understand why this change fixes the bug. Can you please explain?

Also, the first argument ($key) is never used. Why do we need it in isEmptyTranslatableAttribute()?

Gummibeer commented 5 years ago

@dimsav I see no way to cover all possible cases in this package with a single comparison - all will fail in some circumstances. Putting the check in a special method which provides $key and $value allows the user to put in his custom logic which can also differ by attribute name and can also combine multiple checks like is_null($value) || $value === ''. So this is primary the solution to give the user the tools and ability to adjust the logic.

dimsav commented 5 years ago

Love it. Good to go. 👌

Gummibeer commented 5 years ago

https://github.com/dimsav/laravel-translatable/releases/tag/v9.5.0