/** * Store a newly created branch in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Deduction::$rules, Deduction::$messages); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $deduction = new Deduction(); $deduction->deduction_name = Input::get('name'); $deduction->organization_id = '1'; $deduction->save(); Audit::logaudit('Deductions', 'create', 'created: ' . $deduction->deduction_name); return Redirect::route('deductions.index'); }
public function store() { $nominal = Input::get('nominal'); $nominal = str_replace(",", ".", $nominal); $nominal = str_replace(".", "", $nominal); $nominal = substr($nominal, 0, -2); $deduction = new Deduction(); $deduction->location_id = Auth::user()->location_id; $deduction->employee_id = Input::get('employee_id'); $deduction->classification_id = Input::get('classification_id'); $deduction->release_date = Input::get('release_date'); $deduction->nominal = $nominal; $deduction->comments = Input::get('comments'); $deduction->save(); return Response::json(array('id' => $deduction->id)); }