publication publish date rus attribute added
parent
39aa889b90
commit
674b2f9b7c
|
|
@ -85,6 +85,10 @@ class Publication extends Model {
|
||||||
return json_decode($this->params);
|
return json_decode($this->params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPublishDateRusAttribute(): string {
|
||||||
|
return $this->published_at ? $this->published_at->format('d') . ' ' . $this->published_at->getTranslatedMonthName('Do MMMM') . ' ' . $this->published_at->format('Y') : 'когда-то';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function addSection($typeName, $ord = null): ?Model {
|
public function addSection($typeName, $ord = null): ?Model {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class PublicationTransformer extends TransformerAbstract {
|
||||||
'params' => $params,
|
'params' => $params,
|
||||||
'name' => $model->name,
|
'name' => $model->name,
|
||||||
'excerpt' => $model->excerpt,
|
'excerpt' => $model->excerpt,
|
||||||
|
'publish_date_rus' => $model->publish_date_rus,
|
||||||
'is_published' => boolval($model->is_published),
|
'is_published' => boolval($model->is_published),
|
||||||
'published_at' => $model->published_at ? $model->published_at->toIso8601String() : null,
|
'published_at' => $model->published_at ? $model->published_at->toIso8601String() : null,
|
||||||
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : null,
|
'created_at' => $model->created_at ? $model->created_at->toIso8601String() : null,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue