Skip to content
Advertisement

Laravel 8 – How do I fetch data from database and add it in VCard?

I am trying to make vCard for each of my users. I want to fetch data from database to the vCard such as: username, first name, last name, phone number, etc.

As I don’t have much experience using Laravel, I want to know is it possible to add data to this code:

JavaScript

I tried using {{ $user->email }}, {{ $user->username }} like I use in blade.php files but I wasn’t successful with it.

Advertisement

Answer

You first need to take the current user from session. That can be made like that

JavaScript

After you need to assign all the values to your variables like that

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement