app/Http/Controllers/AdminUserController.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)
    {
        $user = User::findOrFail($id);
        if(trim($request->password) == ''){
            $input = $request->except('password');
        }
        else{
            $input = $request->all();
            $input['password'] = bcrypt($request->password);
        }
        if($file = $request->file('signature')){
            $path = Storage::putFileAs('signature/'.$user->username, $file, $user->username.'.'.$file->extension(), ['disk' => 'local']);
            $input['signature'] = $path;
        }
        $user->update($input);
        return redirect('/admin/users');
    }
public function update ( Request $ request , $ id ) { $ user = User :: findOrFail ( $ id ) ; if ( trim ( $ request -> password ) == '' ) { $ input = $ request -> except ( 'password' ) ; } else { $ input = $ request -> all ( ) ; $ input [ 'password' ] = bcrypt ( $ request -> password ) ; } if ( $ file = $ request -> file ( 'signature' ) ) { $ path = Storage :: putFileAs ( 'signature/' . $ user -> username , $ file , $ user -> username . '.' . $ file -> extension ( ) , [ 'disk' => 'local' ] ) ; $ input [ 'signature' ] = $ path ; } $ user -> update ( $ input ) ; return redirect ( '/admin/users' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//