1 <?php
2
3 namespace PLus\Orders\Repositories\Messages;
4
5
6 7 8 9 10
11 class PostRepository extends \PLus\Orders\Repositories\Repository {
12
13
14 15 16 17 18 19
20 public function getPost($consultation_id) {
21 return $this->getTable()->select('post.*,CONCAT_WS(\' \',user.firstname,user.lastname) AS uname')
22 ->where('post.consultation_id', $consultation_id);
23 }
24
25
26
27 28 29 30 31 32
33 public function getLastPost($consultation_id) {
34 return $this->getTable()->select('post.*')
35 ->where('post.consultation_id', $consultation_id)
36 ->order('post.created DESC')
37 ->limit(1)
38 ->fetch();
39 }
40 }
41