Skip to content

Commit

Permalink
fields of models for API
Browse files Browse the repository at this point in the history
  • Loading branch information
akiraz2 committed Sep 28, 2018
1 parent bedba0e commit c22cfbf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion models/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ class Content extends ContentBase
const STATUS_ACTIVE = 10;
const STATUS_INACTIVE = 20;

/**
* @return array
*/
public function fields()
{
return [
'content',
'user_id',
'created_at' => function ($model) {
return date("d.m.y H:i:s", $model->created_at);//$date->format('Y-m-d H:i:s');
}
];
}

/**
* get status text
* @return string
Expand Down Expand Up @@ -153,7 +167,7 @@ public function getUsername()
{
$showUserSupport = $this->getModule()->showUsernameSupport;
$username = !empty($this->user_id) ? $this->user->{$this->getModule()->userName} : $this->ticket->getNameEmail();
if(!$this->isOwn() && !$showUserSupport) {
if (!$this->isOwn() && !$showUserSupport) {
$username = $this->getModule()->userNameSupport;
}
return $username;
Expand Down
4 changes: 2 additions & 2 deletions models/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public function fields()
'category',
'Type',
'title',
'StatusText',
'status',
'priority',
'created_at' => function ($model) {
//$date=new \DateTime($model->created_at);
return date("d.m.y H:i:s", $model->created_at);//$date->format('Y-m-d H:i:s');
}
];
Expand Down

0 comments on commit c22cfbf

Please sign in to comment.