/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(EmployeeRequest $request, $id) { $employee = Employee::findOrFail($id); $employee->update($request->all()); flash()->success('Success!', 'Employee details saved successfully!'); return redirect('employees'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(EmployeeRequest $request, $id) { $employee = Employee::findOrfail($id); $employee->fill($request->all()); $employee->save(); return redirect(route('employees.index'))->with('message', 'Empleado actualizado corectamente'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\EmployeeRequest $request) { // $data = $request->except('_token'); $data['user_id'] = \Auth::User()->id; $employee = new Employee(); $employee->create($data); return back(); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(EmployeeRequest $request, $id) { $employee = $this->employee->where('emp_id', '=', $id)->first(); $employee->fill($request->input())->save(); return redirect('employee/' . $employee->emp_id . '/edit')->with('status', 'Successfully Updated.'); }
/** * Update Employee Information in Database * @param EmployeeRequest $request * @param $id * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update(EmployeeRequest $request, $id) { $employee = Employee::query()->findOrFail($id); if ($request->hasFile('image')) { $image_name = $request->eid . '.' . $request->file('image')->getClientOriginalExtension(); $request->file('image')->move(base_path() . '/resources/assets/images/employee', $image_name); $data = $request->except('image'); $data['image'] = $image_name; $employee->update($data); } else { $employee->update($request->except('image')); } Session::flash('success_message', 'Employee Updated Successfully'); return redirect('employee'); }
public function update($id, EmployeeRequest $request) { $employee = Employee::findOrFail($id); $file = $request->file('photo'); $destinationPath = base_path() . '/public/image/employee/'; if ($request->hasFile('photo')) { $name = time() . $file->getClientOriginalName(); $file->move($destinationPath, $name); $employee->photo = $name; } $employee->name = $request->input('name'); $employee->mobile = $request->input('mobile'); $employee->email = $request->input('email'); $employee->present_address = $request->input('present_address'); $employee->permanent_address = $request->input('permanent_address'); $employee->dob = $request->input('dob'); $employee->designation_id = $request->input('designation_id'); $employee->workspace_id = $request->input('workspace_id'); $employee->employee_type = Config::get('common.employee_type.Regular'); $employee->joining_date = $request->input('joining_date'); $employee->updated_by = Auth::user()->id; $employee->updated_at = time(); $employee->update(); Session()->flash('flash_message', 'Employee has been updated!'); return redirect('employees'); }
/** * Store a newly created resource in storage. * * @param EmployeeRequest $request * @return \Illuminate\Http\Response */ public function store(EmployeeRequest $request) { Employee::create($request->all()); session()->flash('flash_message', 'Werknemer toegevoegd!'); return redirect('werknemers'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(EmployeeRequest $request) { Employee::create($request->all()); return redirect('employee'); }