vendredi 29 juillet 2016

Storing validation rules alongside entries in the database in Laravel 5

I have a Setting model, and a SettingController. They are used for storing application-wide settings as a JSON string into the database.

Problem

Because of the diversity of setting types (checkboxes, inputs, email fields, etc), it is impossible to define the universal validation rules for each setting.

Possible Solution

To solve the problem of having "variable" validation rules, I'm considering storing them as a JSON string in the same table with settings.

Question

My question is, am I heading into the right direction, or am I making some major design flaws that can cause me pain in the future? And is it a good idea to store model's validations in the database?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2atWiMU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire