public function save_options($id) { LeaveWOPay::with('user')->where('leave_id', $id)->update(array('status' => Input::get('status'))); $approve = LeaveWOPay::with('user')->where('leave_id', $id)->first(); $adminlog = new AdminLogWOP(); $adminlog->employee_id = Input::get('employee_id'); $adminlog->leave_id = Input::get('leave_id'); $adminlog->days_of_leave = $approve->days_of_leave; $adminlog->wdays_of_leave = $approve->wdays_of_leave; $adminlog->date_from = $approve->date_from; $adminlog->time_from = $approve->time_from; $adminlog->date_to = $approve->date_to; $adminlog->time_to = $approve->time_to; $adminlog->reason = $approve->reason; $adminlog->message = Input::get('message'); $adminlog->status = Input::get('status'); $adminlog->save(); $userlog = new UserLeaveLog(); $userlog->employee_id = Input::get('employee_id'); $userlog->leave_id = Input::get('leave_id'); $userlog->type_of_leave = 'Leave without pay'; $userlog->days_of_leave = $approve->days_of_leave; $userlog->wdays_of_leave = $approve->wdays_of_leave; $userlog->date_from = $approve->date_from; $userlog->time_from = $approve->time_from; $userlog->date_to = $approve->date_to; $userlog->time_to = $approve->time_to; $userlog->company = ''; $userlog->address = ''; $userlog->reason = $approve->reason; $userlog->status = Input::get('status'); $userlog->save(); $approve = new Approval(); $approve->employee_id = Auth::user()->employee_id; $approve->leave_id = Input::get('leave_id'); $approve->type_of_leave = 'Leave without pay'; $approve->message = Input::get('message'); $approve->status = Input::get('status'); $approve->save(); return Redirect::route('leavewopay'); }
public function post_delete($id) { $d_login = UserLogin::where('employee_id', $id)->first(); $d_login->delete(); $userlog = UserLeaveLog::where('employee_id', $id)->delete(); LeaveWPay::where('employee_id', $id)->delete(); LeaveWOPay::where('employee_id', $id)->delete(); LeaveCounter::where('employee_id', $id)->delete(); LeaveAWT::where('employee_id', $id)->delete(); LeaveOB::where('employee_id', $id)->delete(); AdminLogWP::where('employee_id', $id)->delete(); AdminLogWOP::where('employee_id', $id)->delete(); AdminLogOB::where('employee_id', $id)->delete(); AdminLogAWT::where('employee_id', $id)->delete(); AnnouncementComments::where('employee_id', $id)->delete(); Approval::where('employee_id', $id)->delete(); $d_user = UserDetails::where('employee_id', $id)->first(); $d_user->delete(); return Redirect::route('view_users'); }
public function destroy_approve($id) { AdminLogWOP::where('leave_id', $id)->delete(); return Redirect::route('wo_approve'); }