app/Http/Controllers/Admin/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)
    {
        $user=User::findOrFail($id);
        if(Auth::user()->id==$id){
         Toastr::error('Failed', "User cant Updated own role",["progressBar" => true,"timeOut"=> "1200",]) ;
return redirect()->route('admin.user.index');
        }else{
            $user->role_id=$request->role_id;
            $user->update();
         Toastr::success('Successfully', 'User Role Updated',["progressBar" => true,"timeOut"=> "1200",]) ;
            return redirect()->route('admin.user.index');
        }
    }
public function update ( Request $ request , $ id ) { $ user = User :: findOrFail ( $ id ) ; if ( Auth :: user ( ) -> id == $ id ) { Toastr :: error ( 'Failed' , " User cant Updated own role " , [ " progressBar " => true , " timeOut " => " 1200 " , ] ) ; return redirect ( ) -> route ( 'admin.user.index' ) ; } else { $ user -> role_id = $ request -> role_id ; $ user -> update ( ) ; Toastr :: success ( 'Successfully' , 'User Role Updated' , [ " progressBar " => true , " timeOut " => " 1200 " , ] ) ; return redirect ( ) -> route ( 'admin.user.index' ) ; } }
Update the specified resource in storage.
Update the specified resource in storage .