mercredi 25 novembre 2015

How can I save user's setting for notifications laravel5 and mysql

I am building Restful Api for a mobile application. I need to push the notification to user if he has saved the notification setting to true in his profile.

I have created the following structure:

Users Table:

id name email

1 Test test@test.com

2 Test1 test1@test1.com

Notifications Table:

id notification_name

1 Like Notification

2 Comment Notification

user_notification Table:

id notification_id user_id value (0=off, 1=on)

1            1                 1         0   

2            2                 1         1   

3            1                 1         1   

4            2                 1         1   

In the above table structure I have created a pivot table with an extra field value for saving settings of a user.

Is there any another great way to do this, in which I can minimize my queries and respond fast



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire