Home > Blockchain >  Hi everyone, I'm can't stand with Laravel's Import Excel function. How to get Session
Hi everyone, I'm can't stand with Laravel's Import Excel function. How to get Session

Time:11-26

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.

  • Related