Example #1
0
 /**
  * Store a newly created resource in storage.
  * POST /ob
  *
  * @return Response
  */
 public function store($id)
 {
     LeaveOB::with('user')->where('leave_id', $id)->update(array('status' => Input::get('status')));
     $approve = LeaveOB::with('user')->where('leave_id', $id)->first();
     $adminlog = new AdminLogOB();
     $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->company = Input::get('company');
     $adminlog->address = Input::get('address');
     $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 = 'Application for OB';
     $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 = Input::get('company');
     $userlog->address = Input::get('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 = 'Application for OB';
     $approve->message = Input::get('message');
     $approve->status = Input::get('status');
     $approve->save();
     return Redirect::route('leaveob_admin');
 }