app/Http/Controllers/Admin/documentmanagementController.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(DocumentManagementValidator $request, $id)
    {
        $documentmanagement = DocumentManagement::findorfail($id);
        if ($request->hasFile('pandocument')) {
            $image = $request->file('pandocument');
            $pan = "PAN-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('public/images/PAN Document/', $pan);
            $documentmanagement->pandocument = $pan;
        }
        if ($request->hasFile('pfdocument')) {
            $image = $request->file('pfdocument');
            $pf = "PF-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('public/images/PF Document/', $pf);
            $documentmanagement->pfdocument = $pf;
        }
        if ($request->hasFile('citdocument')) {
            $image = $request->file('citdocument');
            $cit = "CIT-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('public/images/CIT Document/', $cit);
            $documentmanagement->citdocument = $cit;
        }
        if ($request->hasFile('appointmentdocument')) {
            $image = $request->file('appointmentdocument');
            $appointment = "APPOINTMENT-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('public/images/Appointment Document/', $appointment);
            $documentmanagement->appointmentdocument = $appointment;
        }
        if ($request->hasFile('contractdocument')) {
            $image = $request->file('contractdocument');
            $contract = "CONTRACT-" . time() . '.' . $image->getClientOriginalExtension();
            $image->move('public/images/Contract Document/', $contract);
            $documentmanagement->contractdocument = $contract;
        }
        $documentmanagement->staffid = $request->input('staffid');
        $documentmanagement->staffname = $request->input('staffname');
        $documentmanagement->bankaccountnumber = $request->input('bankaccountnumber');
        $documentmanagement->save();
        return redirect()->route('documentmanagement.index')->with('success', 'Employee Document Updated Successfully');
    }
public function update ( DocumentManagementValidator $ request , $ id ) { $ documentmanagement = DocumentManagement :: findorfail ( $ id ) ; if ( $ request -> hasFile ( 'pandocument' ) ) { $ image = $ request -> file ( 'pandocument' ) ; $ pan = " PAN- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'public/images/PAN Document/' , $ pan ) ; $ documentmanagement -> pandocument = $ pan ; } if ( $ request -> hasFile ( 'pfdocument' ) ) { $ image = $ request -> file ( 'pfdocument' ) ; $ pf = " PF- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'public/images/PF Document/' , $ pf ) ; $ documentmanagement -> pfdocument = $ pf ; } if ( $ request -> hasFile ( 'citdocument' ) ) { $ image = $ request -> file ( 'citdocument' ) ; $ cit = " CIT- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'public/images/CIT Document/' , $ cit ) ; $ documentmanagement -> citdocument = $ cit ; } if ( $ request -> hasFile ( 'appointmentdocument' ) ) { $ image = $ request -> file ( 'appointmentdocument' ) ; $ appointment = " APPOINTMENT- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'public/images/Appointment Document/' , $ appointment ) ; $ documentmanagement -> appointmentdocument = $ appointment ; } if ( $ request -> hasFile ( 'contractdocument' ) ) { $ image = $ request -> file ( 'contractdocument' ) ; $ contract = " CONTRACT- " . time ( ) . '.' . $ image -> getClientOriginalExtension ( ) ; $ image -> move ( 'public/images/Contract Document/' , $ contract ) ; $ documentmanagement -> contractdocument = $ contract ; } $ documentmanagement -> staffid = $ request -> input ( 'staffid' ) ; $ documentmanagement -> staffname = $ request -> input ( 'staffname' ) ; $ documentmanagement -> bankaccountnumber = $ request -> input ( 'bankaccountnumber' ) ; $ documentmanagement -> save ( ) ; return redirect ( ) -> route ( 'documentmanagement.index' ) -> with ( 'success' , 'Employee Document Updated Successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//