public function store() { $total = Input::get('total'); $total = str_replace(",", ".", $total); $total = str_replace(".", "", $total); $total = substr($total, 0, -2); $returnment = new Returnment(); $returnment->project_id = Auth::user()->curr_project_id; $returnment->location_id = Auth::user()->location_id; $returnment->issue_id = Input::get('issue_id'); $returnment->employee_id = Input::get('employee_id'); $returnment->retur_date = Input::get('retur_date'); $returnment->total = $total; $returnment->code = $this->generateCode(); $returnment->signature = $this->generateSignature(); $returnment->comments = Input::get('comments'); $returnment->save(); return array('id' => $returnment->id); }
public function giveReturnment($id) { $resign = Resign::find($id); $returnment = new Returnment(); $returnment->project_id = Auth::user()->curr_project_id; $returnment->location_id = Auth::user()->location_id; $returnment->issue_id = $resign->issue_id; $returnment->employee_id = Auth::user()->employee_id; $returnment->resign_id = $resign->id; $returnment->retur_date = date('Y-m-d'); $returnment->total = $resign->returnment; $returnment->code = $this->generateReturCode(); $returnment->signature = $this->generateSignature(); $returnment->save(); $resign->is_returned = 1; $resign->save(); return Response::json(array('returnment' => $returnment->id)); }