search

Home  >  Q&A  >  body text

Can the laravel eloquent model register a service provider?

As shown in the picture, I registered the User model in the service, but when using it, the data retrieved is an empty model.
Can the eloquent model register a service provider? Is there any solution?

黄舟黄舟2796 days ago370

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-05-16 16:49:01

    Looking at your code, it seems that you want to get the model of the currently logged in user. You cannot directly use the Auth facade to get the model of the currently logged in user

    Auth::user()

    Your code seems to have no problem at first glance, so I haven’t studied it in detail. Please check first to see if you are not logged in

    reply
    0
  • Cancelreply