Answer the question
In order to leave comments, you need to log in
How can I implement user settings that depend on his role?
The essence of the task: I'm trying to implement user settings, depending on his role (administrator, editor, user). At the moment, these settings are exclusively related to notifications. For example: An
administrator can have the following settings:
+----+---------------------+----------------------------------+
| id | name | description |
+----+---------------------+----------------------------------+
| 1 | notify_new_comments | Уведомлять о новых комментариях |
+----+---------------------+----------------------------------+
| 2 | notify_new_users | Уведомлять о новых пользователях |
+----+---------------------+----------------------------------+
+----+--------------------+---------------------------------+
| id | name | description |
+----+--------------------+---------------------------------+
| 1 | notify_new_posts | Уведомлять о новых записях |
+----+--------------------+---------------------------------+
| 2 | notify_new_comment | Уведомлять о новых комментариях |
+----+--------------------+---------------------------------+
+----+----------------------------+--------------------------------------+
| id | name | description |
+----+----------------------------+--------------------------------------+
| 1 | notify_new_replies | Уведомлять об ответах на комментарии |
+----+----------------------------+--------------------------------------+
| 2 | notify_new_comment_in_post | Уведомлять об ответах в моих постах |
+----+----------------------------+--------------------------------------+
config('user_presettings.admin);
Answer the question
In order to leave comments, you need to log in
I take from the config / default model attributes and so on. But I have programming projects) Ie. there is nothing to do in the admin. If it is important to do everything in the project from the admin panel, the choice is obvious. Those. the answer is to focus on the needs of the project
xs, I would probably make a separate table and load everything depending on the role during authorization. And you can put in the cache
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question