user() public method

Get the current user from storage.
public user ( string | null $key = null ) : mixed | null
$key string | null Field to retrieve. Leave null to get entire User record.
return mixed | null Either User record or null if no user is logged in, or retrieved field if key is specified.
Exemplo n.º 1
0
 public function beforeDelete(Event $event, Entity $entity, ArrayObject $options)
 {
     if (empty($options['loggedInUser'])) {
         $options['loggedInUser'] = $this->_Auth->user('id');
     }
 }