In CakePHP 3, I found two ways to find if a user is registered.
1st decision
if(!is_null($this->Auth->user('id'))){
2nd decision
if (!is_null($this->request->session()->read('Auth.User.id'))) {
I think the first one is better because it is short and short.
Is there a better way to check if a user is registered?
I'm not looking for speed necessarily. I want a clean and expressive way to write it.
source share