0

I use JWT, and I want to get user id in Laravel-Blade as follow:

<a href="/admin/users/edt/{{auth()->guard('api')->user()->id}}" class="nav-item dropdown-item">Profile</a>

but I receive this error:

Trying to get property 'id' of non-object (View: C:\xampp\htdocs\sanayekala_backend\resources\views\admin.blade.php)

zahid hasan emon
  • 6,023
  • 3
  • 16
  • 28
h na
  • 1
  • `Auth::user()->id` it's also a good idea to check if there is a user with `Auth::user()` – Refilon Jul 15 '22 at 07:44
  • Does this answer your question? [How {{ Auth::user()->name }} is able to print username in blade file?](https://stackoverflow.com/questions/47125197/how-authuser-name-is-able-to-print-username-in-blade-file) – Refilon Jul 15 '22 at 07:46

0 Answers0