Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public $translatable = ['*'] as wildcard. #709

Closed
iMateo opened this issue Dec 26, 2022 · 1 comment
Closed

Add public $translatable = ['*'] as wildcard. #709

iMateo opened this issue Dec 26, 2022 · 1 comment

Comments

@iMateo
Copy link

iMateo commented Dec 26, 2022

October has an amazing behavior \System\Behaviors\SettingsModel::class, which is made a simple custom business logic setup.
After 2 months of development, we noticed that the number of fields in the model exceeded 50.
And when adding a new field, we have to constantly update the model itself and add the name of this field to the translatable array. Of course, the human factor leads to bugs.
We suggest to add asterisk support as wildcard for all existing fields as it works in other service arrays:
protected $guarded = ['*'];
but this time:
public $translatable = ['*']

@iMateo iMateo changed the title Add public $translatable = ['*'] as wildcard for Add public $translatable = ['*'] as wildcard. Dec 26, 2022
@daftspunk
Copy link
Member

It is a nice idea and should be simple to implement, although the results may be unpredictable since a block-list would be required for some core attributes. For example, NestedTree has nest_left, nest_right, etc. It may be difficult to predict all the possibilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants