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
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