diff --git a/app/Services/Admin/Finance/CashAccountService.php b/app/Services/Admin/Finance/CashAccountService.php index 79dfb8d..3252ac8 100644 --- a/app/Services/Admin/Finance/CashAccountService.php +++ b/app/Services/Admin/Finance/CashAccountService.php @@ -13,7 +13,7 @@ class CashAccountService { public function get(): ?CashAccount { - return CashAccount::first(); + return CashAccount::select('id', 'name', 'balance')->first(); } public function getAllTransactions(): Collection @@ -25,6 +25,7 @@ public function getAllTransactions(): Collection } return $cashAccount->cashTransactions() + ->select('id', 'created_by_id', 'reference_type', 'reference_id', 'amount', 'balance_after', 'type', 'description', 'created_at') ->with('createdBy.userProfile') ->latest() ->get(); diff --git a/app/Services/Admin/Finance/EmployeeAdvanceService.php b/app/Services/Admin/Finance/EmployeeAdvanceService.php index e8d079e..df8906a 100644 --- a/app/Services/Admin/Finance/EmployeeAdvanceService.php +++ b/app/Services/Admin/Finance/EmployeeAdvanceService.php @@ -15,7 +15,8 @@ class EmployeeAdvanceService { public function getAll(): Collection { - return EmployeeAdvance::with(['employee.user.userProfile']) + return EmployeeAdvance::select('id', 'employee_id', 'amount', 'paid_amount', 'description', 'due_date', 'status', 'created_at') + ->with(['employee.user.userProfile']) ->latest() ->get(); } diff --git a/app/Services/Admin/HR/EmployeeService.php b/app/Services/Admin/HR/EmployeeService.php index b5a4874..c6bc0c7 100644 --- a/app/Services/Admin/HR/EmployeeService.php +++ b/app/Services/Admin/HR/EmployeeService.php @@ -10,8 +10,12 @@ class EmployeeService { public function getAll(): Collection { - return User::whereHas('employee') - ->with(['userProfile', 'employee']) + return User::select('id', 'email', 'username', 'is_active') + ->whereHas('employee') + ->with([ + 'userProfile' => fn ($q) => $q->select('id', 'user_id', 'full_name', 'phone_number'), + 'employee' => fn ($q) => $q->select('id', 'user_id', 'join_date', 'employment_status', 'base_salary'), + ]) ->latest() ->get(); } diff --git a/app/Services/Admin/HR/LeaveRequestService.php b/app/Services/Admin/HR/LeaveRequestService.php index 30dacdc..f42e29a 100644 --- a/app/Services/Admin/HR/LeaveRequestService.php +++ b/app/Services/Admin/HR/LeaveRequestService.php @@ -12,7 +12,8 @@ class LeaveRequestService { public function getAll(): Collection { - return LeaveRequest::with(['employee.user.userProfile', 'verifiedBy']) + return LeaveRequest::select('id', 'employee_id', 'start_date', 'end_date', 'total_days', 'status', 'created_at') + ->with(['employee.user.userProfile']) ->latest() ->get(); } diff --git a/app/Services/Admin/Master/CategoryService.php b/app/Services/Admin/Master/CategoryService.php index 4974040..eea4da3 100644 --- a/app/Services/Admin/Master/CategoryService.php +++ b/app/Services/Admin/Master/CategoryService.php @@ -9,7 +9,7 @@ class CategoryService { public function getAll(): Collection { - return Category::latest()->get(); + return Category::select('id', 'name')->latest()->get(); } public function create(array $data): Category diff --git a/app/Services/Admin/Master/CustomerService.php b/app/Services/Admin/Master/CustomerService.php index ffbce46..4b5fa95 100644 --- a/app/Services/Admin/Master/CustomerService.php +++ b/app/Services/Admin/Master/CustomerService.php @@ -9,7 +9,7 @@ class CustomerService { public function getAll(): Collection { - return Customer::latest()->get(); + return Customer::select('id', 'name', 'phone_number', 'address')->latest()->get(); } public function create(array $data): Customer diff --git a/app/Services/Admin/Master/SupplierService.php b/app/Services/Admin/Master/SupplierService.php index f5cf3ee..492b2bb 100644 --- a/app/Services/Admin/Master/SupplierService.php +++ b/app/Services/Admin/Master/SupplierService.php @@ -9,7 +9,7 @@ class SupplierService { public function getAll(): Collection { - return Supplier::latest()->get(); + return Supplier::select('id', 'name', 'phone_number', 'address')->latest()->get(); } public function create(array $data): Supplier