How can i get Session:get('user_id') from UserController.php or name of meta tag to use into UserImport.php? I'm having a problem importing data with an Excel file and I need the user id to compare with the table I want to import. Thanks for your help.
CodePudding user response:
Are you using sanctum? If so, you can access the auth()
by using auth('sanctum')->user()
directly from your controller then just passed it as a return value.
Thanks
CodePudding user response:
$user_id = auth()->id();
This will work with both Web and API.