public static function updateLeaveType($data, $id) { $leavetype = Leavetype::find($id); $leavetype->name = array_get($data, 'name'); $leavetype->days = array_get($data, 'days'); $leavetype->update(); }
public static function amendLeaveApplication($data, $id) { $leavetype = Leavetype::find(array_get($data, 'leavetype_id')); $application = Leaveapplication::find($id); $application->applied_start_date = array_get($data, 'applied_start_date'); $application->applied_end_date = array_get($data, 'applied_end_date'); $application->status = 'amended'; $application->date_amended = date('Y-m-d'); $application->leavetype()->associate($leavetype); $application->update(); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $leavetypes = Leavetype::find($id); return View::make('leavetypes.edit', compact('leavetypes')); }
public function employeesleave() { $id = Input::get("balance"); $leavetype = Leavetype::find($id); $emps = DB::table('leaveapplications')->join('employee', 'leaveapplications.employee_id', '=', 'employee.id')->join('leavetypes', 'leaveapplications.leavetype_id', '=', 'leavetypes.id')->where('leavetype_id', '=', $id)->where('date_approved', '!=', 'NULL')->get(); $organization = Organization::find(1); $pdf = PDF::loadView('leavereports.employeeReport', compact('emps', 'leavetype', 'organization'))->setPaper('a4')->setOrientation('potrait'); return $pdf->stream('Employees_on_Leave_Report.pdf'); }
public function redeem() { $employee = Employee::find(Input::get('employee_id')); $leeavetype = Leavetype::find(Input::get('leavetype_id')); Leaveapplication::RedeemLeaveDays($employee, $leavetype); return Redirect::route('leaveapplications.index'); }
public static function getName($id) { $leavetype = Leavetype::find($id); return $leavetype->name; }