21 lines
471 B
PHP
21 lines
471 B
PHP
<?php
|
|
|
|
class Attachment extends \DB\SQL\Mapper {
|
|
|
|
function __construct($db)
|
|
{
|
|
parent::__construct($db, 'attachments');
|
|
}
|
|
|
|
public function findWithUserByTicketId($ticket_id){
|
|
return $this->db->exec(
|
|
'SELECT a.*, u.username
|
|
FROM attachments a
|
|
LEFT JOIN users u ON u.id = a.uploaded_by
|
|
WHERE a.ticket_id = ?
|
|
ORDER BY a.created_at DESC',
|
|
[$ticket_id]
|
|
);
|
|
}
|
|
|
|
} |