feat(staff): scope scanner management and category assignments by event

This commit is contained in:
2026-09-30 15:31:56 -03:00
parent 655364bfec
commit e64393812c
8 changed files with 59 additions and 25 deletions

View File

@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Collection;
class StaffFormService
{
/** @return array{categories: Collection<int, Category>} */
public function get(Tenant $tenant): array
public function get(Tenant $tenant, ?int $eventId = null): array
{
return [
'categories' => Category::query()
@@ -20,6 +20,8 @@ class StaffFormService
->orWhereHas('catalogItems', fn (Builder $items) => $items
->where('tenant_code', $tenant->codigo));
})
->when($eventId !== null, fn (Builder $query) => $query->whereHas(
'catalogItems', fn (Builder $items) => $items->where('tenant_code', $tenant->codigo)->where('event_id', $eventId)))
->orderBy('nombre')
->get(),
];