Home > Software engineering >  I'm can't stand with Laravel's Import Excel function
I'm can't stand with Laravel's Import Excel function

Time:11-27

How can I get Session:get('user_id') from UserController.php or name of meta tag to use into UserImport.php?
I have a problem importing data with an Excel file and I need the user id to compare with the table I want to import.

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