app/Http/Controllers/recursoshumanos/Rrhcargocontroller.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
      try {
        $request->validate([
            'nombre'=>'required']);
            $cargos =new Rrhcargo();
            $cargos->nombre=$request->nombre;
            $cargos->save();
      return redirect()->route('cargos.index');
    } catch (\Exception $exception) {
        return  redirect()->back()->with('error', "Error" . $exception->getMessage());
    }
    }
public function store ( Request $ request ) { try { $ request -> validate ( [ 'nombre' => 'required' ] ) ; $ cargos = new Rrhcargo ( ) ; $ cargos -> nombre = $ request -> nombre ; $ cargos -> save ( ) ; return redirect ( ) -> route ( 'cargos.index' ) ; } catch ( \ Exception $ exception ) { return redirect ( ) -> back ( ) -> with ( 'error' , " Error " . $ exception -> getMessage ( ) ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .