app/Http/Controllers/UserController.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(UserRequest $request, $id)
    {
        $user = User::where('id', $id)->first();
        $user->fill($request->all());
        if(!$user->save())
        {
            return redirect()->back()->withInput()->withErrors();
        }
        return redirect()->route('users.edit', [
            'user' => $user->id
        ])->with([
            'color'=>'alert-success',
            'message' => 'Usuario atualizado com sucesso.'
        ]);
    }
public function update ( UserRequest $ request , $ id ) { $ user = User :: where ( 'id' , $ id ) -> first ( ) ; $ user -> fill ( $ request -> all ( ) ) ; if ( ! $ user -> save ( ) ) { return redirect ( ) -> back ( ) -> withInput ( ) -> withErrors ( ) ; } return redirect ( ) -> route ( 'users.edit' , [ 'user' => $ user -> id ] ) -> with ( [ 'color' => 'alert-success' , 'message' => 'Usuario atualizado com sucesso.' ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .