app/Http/Controllers/recursoshumanos/Rrhcargocontroller.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(Request $request, $rrcargo)
    {
        try {
            $request->validate([
                'nombre'=>'required']);
                $rrcargo = Rrhcargo::find($rrcargo);
                $rrcargo->nombre=$request->nombre;
                $rrcargo->save();
          return redirect()->route('rhcargos.index');
        } catch (\Exception $exception) {
            return  redirect()->back()->with('error', "Error" . $exception->getMessage());
        }
    }
public function update ( Request $ request , $ rrcargo ) { try { $ request -> validate ( [ 'nombre' => 'required' ] ) ; $ rrcargo = Rrhcargo :: find ( $ rrcargo ) ; $ rrcargo -> nombre = $ request -> nombre ; $ rrcargo -> save ( ) ; return redirect ( ) -> route ( 'rhcargos.index' ) ; } catch ( \ Exception $ exception ) { return redirect ( ) -> back ( ) -> with ( 'error' , " Error " . $ exception -> getMessage ( ) ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .