Пример #1
0
 public function store()
 {
     $total = Input::get('total');
     $total = str_replace(",", ".", $total);
     $total = str_replace(".", "", $total);
     $total = substr($total, 0, -2);
     $spending = new Spending();
     $spending->project_id = Auth::user()->curr_project_id;
     $spending->location_id = Auth::user()->location_id;
     $spending->employee_id = Input::get('employee_id');
     $spending->spendable_type = 'Classification';
     $spending->spendable_id = Input::get('classification_id');
     $spending->spend_date = Input::get('spend_date');
     $spending->total = $total;
     $spending->code = $this->generateCode();
     $spending->signature = $this->generateSignature();
     $spending->comments = Input::get('comments');
     $spending->save();
     Session::flash('message', 'Sukses menambahkan Pengeluaran');
     return array('id' => $spending->id);
 }