app/Http/Controllers/Staff/SigningController.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, $id)
    {
        $validatedData = $request->validate([
            'nombre' => 'required|string|max:255|regex:/^[A-ZÑ ]+$/',
            'primerApellido' => 'required|string|max:255|regex:/^[A-ZÑ ]+$/',
            'segundoApellido' => 'required|string|max:255|regex:/^[A-ZÑ ]+$/',
            'abrTitulo' => 'required|string|max:20|regex:/^[A-zÑñ. ]+$/'
        ]);
        $action = 'Firma::create';
        $table  = 'firmas';
        try {
            $firma = Firma::findOrFail($id);
            if ( $firma->update($request->all()) )
                 if ( $this->history($firma, $action, $table) )
                    $response = 202;
                else    
                    $response = 303; 
            else    
                $response = 302;
        } catch (Exception $e) {
            $response = 302;
        }
    return redirect()->route('signing.index')->with('code', $response);
    }
public function update ( Request $ request , $ id ) { $ validatedData = $ request -> validate ( [ 'nombre' => 'required|string|max:255|regex:/^[A-ZÑ ]+$/', 'primerApellido' => 'required|string|max:255|regex:/^[A-ZÑ ]+$/', 'segundoApellido' => 'required|string|max:255|regex:/^[A-ZÑ ]+$/', 'abrTitulo' => 'required|string|max:20|regex:/^[A-zÑñ. ]+$/' ] ) ; $ action = 'Firma::create' ; $ table = 'firmas' ; try { $ firma = Firma :: findOrFail ( $ id ) ; if ( $ firma -> update ( $ request -> all ( ) ) ) if ( $ this -> history ( $ firma , $ action , $ table ) ) $ response = 202 ; else $ response = 303 ; else $ response = 302 ; } catch ( Exception $ e ) { $ response = 302 ; } return redirect ( ) -> route ( 'signing.index' ) -> with ( 'code' , $ response ) ; }
Update the specified resource in storage.
Update the specified resource in storage .