public function getUnclearedPayslips($empid) { if ($this->validateAdmin()) { echo json_encode(Payslip::GetUncleared($empid)); } else { echo 0; } }
function payslip() { $p = new Payslip(); $users = $p->where('office_id', '=', 21)->get(); foreach ($users as $user) { $deductions = $user->deductions; foreach ($deductions as $d) { echo $d->amount . '<br>'; } } $d = new Deductions(); $deductions = $d->where('id', '=', 126)->get(); foreach ($deductions as $dd) { echo $dd->employee->lname; } // For single record $deductions = $d->find(126); echo $deductions->employee->lname; }