app/Http/Controllers/Staff/ChargeController.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)
    {
        $validatedData = $request->validate([
            'desc_cargo' => 'required|string|max:255',
            'edo' => 'required|numeric|min:0|max:1',
        ]);
        $action = 'Cargo::create';
        $table  = 'cargos';
        if ( $save = Cargo::create($request->all()) )
             if ( $this->history($save, $action, $table) )
                $response = 200;
            else    
                $response = 303; 
        else    
            $response = 302;
    return redirect()->route('charge.index')->with('code', $response);
    }
public function store ( Request $ request ) { $ validatedData = $ request -> validate ( [ 'desc_cargo' => 'required|string|max:255' , 'edo' => 'required|numeric|min:0|max:1' , ] ) ; $ action = 'Cargo::create' ; $ table = 'cargos' ; if ( $ save = Cargo :: create ( $ request -> all ( ) ) ) if ( $ this -> history ( $ save , $ action , $ table ) ) $ response = 200 ; else $ response = 303 ; else $ response = 302 ; return redirect ( ) -> route ( 'charge.index' ) -> with ( 'code' , $ response ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .