Skip to content

[Bug]: I used children CalendarResource but children Resource with now showing title #107

@priteshqualitycode

Description

@priteshqualitycode

What happened?

public function getResources(): Collection|array
{
return UnitType::query()
->with(['units' => fn($q) => $q->where('is_active', true)->orderBy('sort_order')])
->orderBy('sort_order')
->get()
->map(function ($unitType) {
return CalendarResource::make("unit-type-{$unitType->id}")
->title($unitType->name)
->children(
$unitType->units->map(fn ($unit) =>
CalendarResource::make("unit-{$unit->id}")
->title($unit->unit_name)
)->toArray()
);
});
}

How to reproduce the bug

public function getResources(): Collection|array
{
return UnitType::query()
->with(['units' => fn($q) => $q->where('is_active', true)->orderBy('sort_order')])
->orderBy('sort_order')
->get()
->map(function ($unitType) {
return CalendarResource::make("unit-type-{$unitType->id}")
->title($unitType->name)
->children(
$unitType->units->map(fn ($unit) =>
CalendarResource::make("unit-{$unit->id}")
->title($unit->unit_name)
)->toArray()
);
});
}

Package Version

2.0

PHP Version

8.2

Laravel Version

12

Which operating systems does with happen with?

No response

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions