Search code examples
laravellaravel-5laravel-5.3

How to make Auth::user() for another table in laravel


When we login into laravel application we can get details of logged user through Auth::user(). But I want to make similar thing for another table for instance when user logs in it also stores information from stores table and I should be able to access it through Auth2::store().

What is the process and can anyone redirect me to the solution


Solution

  • I'm not sure if you're interested in multi-auth?

    If the user is related to a store, just do Auth::user()->store.

    Alternatively, you can create a Facade and the method store that does Auth::user()->store.