Get the user name

@Howan Ingo Polster
Thu, 05 Sep 2024 13:37:07 +0000

Hey everyone,

These are my Tables in my DB.

when i open now for example tickets/view/4 it looks like this.

So i get the related ticket-snaps at the button.

and this is the code so far.

# TicketController.php
$ticket = $this->Tickets->get($id, contain: ['Users', 'Tags', 'TicketSnaps']);

# tickets/view.php
 <?php foreach ($ticket->ticket_snaps as $ticketSnap) : ?>

<?= h($ticketSnap->id) ?>
<?= h($ticketSnap->ticket_id) ?>
<?= h($ticketSnap->user_id) ?>
<?= h($ticketSnap->text) ?>

<?php endforeach; ?>

What do i have to change to get the user id replaced there by user name from the users table?
Somehow i have to take the user_id and ask the user table for the names.

??? ->get($ticketSnap->id)

Thank you