app/Http/Controllers/Backend/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(Request $request, $id)
    {
        $update=User::find($id);
        $update->role=$request->role;
        $update->name=$request->name;
        $update->phone=$request->phone;
        $update->email=$request->email;
        if($request->hasFile('image')){
            $file=$request->file('image');
            $extension=$file->getClientOriginalExtension();
            $myImage=time().'.'.$extension;
            $file->move('upload/user_images/',$myImage);
            $update->image=$myImage;
        }
        $update->save();
        Session::flash('success','User Updated successfully');
       return redirect()->back();
    }
public function update ( Request $ request , $ id ) { $ update = User :: find ( $ id ) ; $ update -> role = $ request -> role ; $ update -> name = $ request -> name ; $ update -> phone = $ request -> phone ; $ update -> email = $ request -> email ; if ( $ request -> hasFile ( 'image' ) ) { $ file = $ request -> file ( 'image' ) ; $ extension = $ file -> getClientOriginalExtension ( ) ; $ myImage = time ( ) . '.' . $ extension ; $ file -> move ( 'upload/user_images/' , $ myImage ) ; $ update -> image = $ myImage ; } $ update -> save ( ) ; Session :: flash ( 'success' , 'User Updated successfully' ) ; return redirect ( ) -> back ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .