Hi all,
Can you please let me know if the below is the proper way to list all users except the one currently logged in the view ?
<?php //Listing all users
foreach($users as $user) :
if($user->id != $this->request->getSession()->read('Auth')->id):
?>
<tr>
<td class="align-middle"><?= $user->firstname ?></td>
<td class="align-middle"><?= $user->lastname ?></td>
<td class="align-middle"><?= $user->email ?></td>
<td class="align-middle"><?= $user->role ?></td>
<td class="align-middle"><?= $user->created->format('d/m/Y') ?></td>
<td class="align-middle">
<?= $this->Html->link('<i class="far fa-trash-alt"></i>', ['action' => 'delete', $user->id], ['class' => 'btn btn-danger', 'escape' => false]) ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>