I have the following relationships:
User hasMany UserNotificationNotification hasMany UserNotificationUserNotificationbelongs UsertoNotification
Tablenotificationshas the following columns: id, subject,content
Tableusers_notificationshas the following columns: id, user_id, notification_id,status
Q UsersController, how can I get all notifications from one user? (This means that for each notification, all this data: subject, content and status).
And also, how can I limit the number of returned fields? When I make a request from UserController, I do not want to retrieve any field from the User model in the find () array.
Thank!
source
share