Logged in User identification

Laraship QuestionsCategory: TechnicalLogged in User identification
Michael Chen asked 4 years ago
Hello We want to set custom pricing for a user. From my understanding, the produt listing is fetched from Corals\Modules\Ecommerce\Http\Controllers\index(), which then calls $products = Shop::getProducts($request); on line 27. So my question is, how do I identify if request is for a logged in user and user Id of the logged in user?
1 Answers
laraship Staff answered 4 years ago
Hello You can check if user is logged in by checking the user() object and check if it's not null, if it's not null you can get user id by user()->id