get additional property
This commit is contained in:
@ -190,12 +190,15 @@ class EntityRelation
|
||||
{
|
||||
$relations = $this->getEntityRelationsBySlug($entity);
|
||||
if ($relations){
|
||||
$relationsArr = [];
|
||||
foreach ($relations as $relation){
|
||||
$moduleClass = $this->getAdditionalPropertyClassBySlug($relation);
|
||||
if ($moduleClass and method_exists($moduleClass, "getItems")) {
|
||||
return $moduleClass->getItems($entity, $model);
|
||||
$relationsArr[$relation] = $moduleClass->getItems($entity, $model);
|
||||
}
|
||||
}
|
||||
|
||||
return $relationsArr;
|
||||
}
|
||||
|
||||
return [];
|
||||
|
@ -26,17 +26,23 @@ $table->beforePrint(function () use ($content) {
|
||||
});
|
||||
|
||||
$entityRelation = new \kernel\EntityRelation();
|
||||
$additional = $entityRelation->getEntityAdditionalProperty("post", $content);
|
||||
$additionals = $entityRelation->getEntityAdditionalProperty("post", $content);
|
||||
|
||||
foreach ($additionals as $key => $additional) {
|
||||
$table->addRow($key, function () use ($additional) {
|
||||
return $additional;
|
||||
}, ['after' => 'user_id']);
|
||||
}
|
||||
|
||||
$table->rows([
|
||||
'created_at' => function ($data) {
|
||||
if (!$data){
|
||||
if (!$data) {
|
||||
return null;
|
||||
}
|
||||
return (new DateTimeImmutable($data))->format("d-m-Y");
|
||||
},
|
||||
'updated_at' => function ($data) {
|
||||
if (!$data){
|
||||
if (!$data) {
|
||||
return null;
|
||||
}
|
||||
return (new DateTimeImmutable($data))->format("d-m-Y");
|
||||
|
Reference in New Issue
Block a user