Logged in User identification

Logged in User identification

Laraship QuestionsCategory: TechnicalLogged in User identification
Michael Chen asked 7 months 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 7 months 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

70% OFF

No Minimum, No Exceptions
 
GO TO STORE
close-link