0

I'm developing in admin side. And I needs to find user_id. The code

$this->user->getId()

provides no information. Is there any way to get user id. Thanks.

Pradeep Sapkota
  • 2,041
  • 1
  • 16
  • 30

1 Answers1

1

Here is the best way:

You cannot directly access user_id from database since it is protected.

So you have to access it from session.

$this->session->data['user_id'];

This returns the id of currently logged user.

Pradeep Sapkota
  • 2,041
  • 1
  • 16
  • 30