1 <?php
2
3 namespace PLus\Orders\Repositories\Messages;
4
5
6
7 8 9 10 11
12 class CommentRepository extends \PLus\Orders\Repositories\Repository {
13
14
15 16 17 18 19 20
21 public function findById($id) {
22 return $this->getTable()
23 ->select('comment.*')->wherePrimary($id)->fetch();
24 }
25
26
27 28 29 30 31 32
33 public function getCommentByItemorderId($itemorder_id) {
34 return $this->getTable()
35 ->select('comment.*, CASE WHEN user.isunit=1 THEN user:unit_user.unit.name ELSE CONCAT_WS(\' \',user.firstname, user.lastname) END AS uname')
36 ->where('comment.itemorder_id', $itemorder_id);
37 }
38 }
39