feat: Implement staff management features; add controller, service, resource, routes, and tests for staff and category assignments

This commit is contained in:
2026-08-04 16:20:30 -03:00
parent 3a039a6055
commit 2a15dc92be
18 changed files with 618 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Domains\Forms\Services;
use App\Domains\Catalog\Models\Category;
use App\Domains\Tenant\Models\Tenant;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
class StaffFormService
{
/** @return array{categories: Collection<int, Category>} */
public function get(Tenant $tenant): array
{
return [
'categories' => Category::query()
->whereNull('categoria_id')
->where(function (Builder $query) use ($tenant): void {
$query->where('tenant_code', $tenant->codigo)
->orWhereHas('catalogItems', fn (Builder $items) => $items
->where('tenant_code', $tenant->codigo));
})
->orderBy('nombre')
->get(),
];
}
}