E
E
Elios2015-12-20 16:14:27
Yii
Elios, 2015-12-20 16:14:27

How to organize settings change by user in Yii2?

How to organize settings change by user in Yii2? Under the settings we mean the params.php file in which you can store, for example, the name of the site, etc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Muhammad, 2015-12-20
@strelov1

Why not store these values ​​in the database? Or just serialize the array and save it to a file.

V
Vladimir Korovin, 2015-12-21
@vakorovin

It is quite possible (and I have implemented it more than once) to store settings in json format. You inherit from Model, set attributes, set rules, create a method a la save and wrap the array of parameters in it in json and save it at least in the users table in some field of the params type. Actually getting these settings is not a problem in reverse order. This gives a big plus - you are not tied to a specific set of parameters, because. anyway, all settings will be stored in one field, then you can infinitely increase the number of these parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question