Skip to content

Commit c22cfbf

Browse files
committed
fields of models for API
1 parent bedba0e commit c22cfbf

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

models/Content.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ class Content extends ContentBase
3636
const STATUS_ACTIVE = 10;
3737
const STATUS_INACTIVE = 20;
3838

39+
/**
40+
* @return array
41+
*/
42+
public function fields()
43+
{
44+
return [
45+
'content',
46+
'user_id',
47+
'created_at' => function ($model) {
48+
return date("d.m.y H:i:s", $model->created_at);//$date->format('Y-m-d H:i:s');
49+
}
50+
];
51+
}
52+
3953
/**
4054
* get status text
4155
* @return string
@@ -153,7 +167,7 @@ public function getUsername()
153167
{
154168
$showUserSupport = $this->getModule()->showUsernameSupport;
155169
$username = !empty($this->user_id) ? $this->user->{$this->getModule()->userName} : $this->ticket->getNameEmail();
156-
if(!$this->isOwn() && !$showUserSupport) {
170+
if (!$this->isOwn() && !$showUserSupport) {
157171
$username = $this->getModule()->userNameSupport;
158172
}
159173
return $username;

models/Ticket.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public function fields()
6565
'category',
6666
'Type',
6767
'title',
68-
'StatusText',
68+
'status',
69+
'priority',
6970
'created_at' => function ($model) {
70-
//$date=new \DateTime($model->created_at);
7171
return date("d.m.y H:i:s", $model->created_at);//$date->format('Y-m-d H:i:s');
7272
}
7373
];

0 commit comments

Comments
 (0)