diff --git a/app/Filament/Tenant/Resources/WorkOrderResource.php b/app/Filament/Tenant/Resources/WorkOrderResource.php index 1ca8f7c..d43005f 100644 --- a/app/Filament/Tenant/Resources/WorkOrderResource.php +++ b/app/Filament/Tenant/Resources/WorkOrderResource.php @@ -247,9 +247,10 @@ class WorkOrderResource extends Resource } /** - * Mechanics see only WOs assigned to them. - * Everyone else (admin, manager, receptionist, accountant, viewer) sees all. - * TenantScope already filters by company_id, so no cross-tenant leak is possible. + * Mechanics (role='mechanic') see only WOs assigned to them. + * All other roles see everything in the current tenant. + * Uses role column directly — no Spatie dependency — to avoid + * team_id misconfiguration causing wrong results. */ public static function getEloquentQuery(): Builder { @@ -258,8 +259,7 @@ class WorkOrderResource extends Resource if (! $user) return $query->whereRaw('0 = 1'); - // Mechanic role: show only WOs where they are the assigned master. - if ($user->isMechanic()) { + if ($user->role === 'mechanic') { return $query->where('master_id', $user->id); }