Laravel: Adding preferences for each user

Below each “config” panel there is a whole odyssey behind it

Wordpress General Settings panel

Can we just store JSON and call it a day?

Creating a new repository from a JSON tree.

What about the old abominable “horizontal table”?

| user_id | dark_mode | notify | notify_sms | notify_email |
| ------- | --------- | ------ | ---------- | ------------ |
| 1 | true | true | false | true |
| 2 | false | false | false | false |
| 3 | false | true | true | false |
| ... |
SELECT * FROM 'settings' WHERE 'user_id' = 14
SELECT * FROM 'users' 
WHERE 'users'.'id' = 14
JOIN 'settings'
ON 'users.id' = 'settings.user_id'

JSON and horizontal table?

| user_id | notifications | json |
| ------- | ------------- | ---- |
| 1 | true | ... |
| 2 | false | ... |
| 3 | false | ... |

How settings should be done

Entity–relationship model of a settings storage approach.

A drop-in solution: Laraconfig

+------+   +-------+   +---------+
| User +---> Value |---> Setting |
+------+ +-------+ +---------+

Cache for the speed

Migrating settings like there is no tomorrow

Creating settings automatically

Graphic Designer graduate. Full Stack Web Developer. Retired Tech & Gaming Editor.