A
A
Alexey Sklyarov2018-11-27 16:04:57
Laravel
Alexey Sklyarov, 2018-11-27 16:04:57

How to bind the user settings model to the User model?

When developing notifications (using the standard Notifications class), it became possible to get all notifications in this way:
Auth::user()->notifications
I have a table user_settingsthat stores settings for each user. How can they implement the ability to access user settings, not through the UserSettings model, but in the same way as for notifications Auth::user()->settings?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin B., 2018-11-27
@0example

It is logical that in the User model you need to create a settings connection with the UserSetting model, thus you can get them as Auth::user()->settings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question