public function resetPassword(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('user', 'update')) {
            return $this->noPermission();
        }
        // validation
        $validator = Validator::make(
            $request->all(), [
            'password' => 'required|same:confpassword',
            'id' => 'required',
            ]
        );

        // if validation fails return json response
        if ($validator->fails()) {
            return $this->response("Please check all required fields!", 400, null, false, false, true, $validator->errors());
        }

        $user = User::where('userID', $request->id)->update(
            [
            'password' => $password = Hash::make($request->password)
            ]
        );

        if ($user) {
            $result = $this->response('Password is updated');
        }else{
            $result = $this->response('Internal server error. Please try again later', 500);
        }
        return $result;
    }
public function resetPassword(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('user', 'update')) {
            return $this->noPermission();
        }
        // validation
        $validator = Validator::make(
            $request->all(), [
            'password' => 'required|same:confpassword',
            'id' => 'required',
            ]
        );

        // if validation fails return json response
        if ($validator->fails()) {
            return $this->response("Please check all required fields!", 400, null, false, false, true, $validator->errors());
        }

        $user = User::where('userID', $request->id)->update(
            [
            'password' => $password = Hash::make($request->password)
            ]
        );

        if ($user) {
            $result = $this->response('Password is updated');
        }else{
            $result = $this->response('Internal server error. Please try again later', 500);
        }
        return $result;
    }
public function resetPassword ( Request $ request ) { // check if user has permissions to access this link if ( ! User :: hasAccess ( 'user' , 'update' ) ) { return $ this -> noPermission ( ) ; } // validation $ validator = Validator :: make ( $ request -> all ( ) , [ 'password' => 'required|same:confpassword' , 'id' => 'required' , ] ) ; // if validation fails return json response if ( $ validator -> fails ( ) ) { return $ this -> response ( "Please check all required fields!" , 400 , null , false , false , true , $ validator -> errors ( ) ) ; } $ user = User :: where ( 'userID' , $ request -> id ) -> update ( [ 'password' => $ password = Hash :: make ( $ request -> password ) ] ) ; if ( $ user ) { $ result = $ this -> response ( 'Password is updated' ) ; } else { $ result = $ this -> response ( 'Internal server error. Please try again later' , 500 ) ; } return $ result ; }
Reset users password.

@param  Request $request
@return array
Reset users password .