app/Http/Controllers/Admin/UserSettingsController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \SON\Models\User  $user
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, User $user)
    {
        $form = \FormBuilder::create(UserSettingsForm::class);
        if(!$form->isValid()){
            return redirect()
                ->back()
                ->withErrors($form->getErrors())
                ->withInput();
        }
        $data = $form->getFieldValues();
        $data['password'] = bcrypt($data['password']);
        \Auth::user()->update($data);
        $request->session()->flash('message', 'Senha alterada com sucesso!');
        return redirect()->route('admin.users.settings.edit');
    }
public function update ( Request $ request , User $ user ) { $ form = \ FormBuilder :: create ( UserSettingsForm :: class ) ; if ( ! $ form -> isValid ( ) ) { return redirect ( ) -> back ( ) -> withErrors ( $ form -> getErrors ( ) ) -> withInput ( ) ; } $ data = $ form -> getFieldValues ( ) ; $ data [ 'password' ] = bcrypt ( $ data [ 'password' ] ) ; \ Auth :: user ( ) -> update ( $ data ) ; $ request -> session ( ) -> flash ( 'message' , 'Senha alterada com sucesso!' ) ; return redirect ( ) -> route ( 'admin.users.settings.edit' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .