app/Http/Controllers/Admin/employeeterminationController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(EmployeeTerminationValidator $request, $id)
    {
        $employeetermination = EmployeeTermination::findorfail($id);
        if ($request->hasFile('terminationdocument')) {
            $image = $request->file('terminationdocument');
            $term = "TERMINATION-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('public/images/EmployeeTermination/', $term);
            $employeetermination->terminationdocument = $term;
        }
        $employeetermination->staffname = $request->input('staffname');
        $employeetermination->staffcode = $request->input('staffcode');
        $employeetermination->changestatus = $request->input('changestatus');
        $employeetermination->noticedate = $request->input('noticedate');
        $employeetermination->serviceenddate = $request->input('serviceenddate');
        $employeetermination->noticedate = $request->input('noticedate');
        $employeetermination->forwardto = $request->input('forwardto');
        $employeetermination->reason = $request->input('reason');
        $employeetermination->details = $request->input('details');
        $employeetermination->save();
        return redirect()->route('employeetermination.index')->with('success', 'Employee Termination Updated Successfully');
    }
public function update ( EmployeeTerminationValidator $ request , $ id ) { $ employeetermination = EmployeeTermination :: findorfail ( $ id ) ; if ( $ request -> hasFile ( 'terminationdocument' ) ) { $ image = $ request -> file ( 'terminationdocument' ) ; $ term = " TERMINATION- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'public/images/EmployeeTermination/' , $ term ) ; $ employeetermination -> terminationdocument = $ term ; } $ employeetermination -> staffname = $ request -> input ( 'staffname' ) ; $ employeetermination -> staffcode = $ request -> input ( 'staffcode' ) ; $ employeetermination -> changestatus = $ request -> input ( 'changestatus' ) ; $ employeetermination -> noticedate = $ request -> input ( 'noticedate' ) ; $ employeetermination -> serviceenddate = $ request -> input ( 'serviceenddate' ) ; $ employeetermination -> noticedate = $ request -> input ( 'noticedate' ) ; $ employeetermination -> forwardto = $ request -> input ( 'forwardto' ) ; $ employeetermination -> reason = $ request -> input ( 'reason' ) ; $ employeetermination -> details = $ request -> input ( 'details' ) ; $ employeetermination -> save ( ) ; return redirect ( ) -> route ( 'employeetermination.index' ) -> with ( 'success' , 'Employee Termination Updated Successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .