minor update

master
Константин 2023-11-10 17:19:45 +03:00
parent 31d28c605b
commit 20beb09593
1 changed files with 5 additions and 1 deletions

View File

@ -19,7 +19,7 @@ class PageTransformer extends TransformerAbstract {
]; ];
protected array $availableIncludes = [ protected array $availableIncludes = [
'children', 'parent', 'parents', 'picture', 'sections', 'sidebars', 'publications', 'hasChildren', 'children', 'parent', 'parents', 'picture', 'sections', 'sidebars', 'publications',
'registries', 'registry', 'permissions' 'registries', 'registry', 'permissions'
]; ];
@ -40,6 +40,10 @@ class PageTransformer extends TransformerAbstract {
]; ];
} }
public function includeHasChildren(Page $model): Primitive {
return $this->primitive($model->children()->exists());
}
public function includeChildren(Page $model): Collection { public function includeChildren(Page $model): Collection {
return $this->collection($model->children, new PageTransformer()); return $this->collection($model->children, new PageTransformer());
} }