Logged in User identification

Logged in User identification

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

UP TO 60% OFF

LIMITED TIME OFFER
SHOP NOW
Offer Expires Oct 30
close-link