app/Http/Controllers/__Old__/__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(UpdateUserRequest $request, $id)
    {
        $input = $request->all();
        if(!empty($input['password'])){ 
            $input['password'] = Hash::make($input['password']);
        }else{
            $input = array_except($input,array('password'));    
        }
        $user = User::find($id);
        $user->update($input);
        DB::table('role_user')->where('user_id',$id)->delete();
        foreach ($request->input('roles') as $key => $value) {
            $user->attachRole($value);
        }
        Log::info(Auth::user()->username . " (" . Auth::user()->id . ") UPDATED user (" . $user->id . ")\r\n", 
            [json_decode($user, true)]
        );
        Session::flash('success','User updated successfully');
        return redirect()->route('users.index');
    }
public function update ( UpdateUserRequest $ request , $ id ) { $ input = $ request -> all ( ) ; if ( ! empty ( $ input [ 'password' ] ) ) { $ input [ 'password' ] = Hash :: make ( $ input [ 'password' ] ) ; } else { $ input = array_except ( $ input , array ( 'password' ) ) ; } $ user = User :: find ( $ id ) ; $ user -> update ( $ input ) ; DB :: table ( 'role_user' ) -> where ( 'user_id' , $ id ) -> delete ( ) ; foreach ( $ request -> input ( 'roles' ) as $ key => $ value ) { $ user -> attachRole ( $ value ) ; } Log :: info ( Auth :: user ( ) -> username . "  ( " . Auth :: user ( ) -> id . " ) UPDATED user ( " . $ user -> id . " ) \r \n " , [ json_decode ( $ user , true ) ] ) ; Session :: flash ( 'success' , 'User updated successfully' ) ; return redirect ( ) -> route ( 'users.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// Save entry to log file using built-in Monolog