while() loop runs indefinitely; the condition won’t change; .replace() doesn’t work as expected [duplicate]

This question already has an answer here: Replace method doesn't work 4 answers I am trying to replace a letter with a white space ” ” inside a word using the following JS code: let letter = document.querySelector(“#letter”).value.toLowerCase(); var word = “letters”; var i = word.indexOf(letter); console.log(“word[i]: ” + word[i]); while(i > -1) { console.log(i);…

Details

Laravel store user ip

I want store user ip when register: use Illuminate\Http\Request; public function register(Request $request) { $validator = Validator::make($request->all(), [ ‘name’ => ‘required|string’, ‘phone’ => ‘required|numeric|digits:11’ ]); if ($validator->fails()) { return response()->json([‘error’=>$validator->errors()], 200); } $user = Agent::where(‘phone’, $request->phone)->where(‘verified’, 1)->first(); if($user){ return response()->json([‘success’=> ‘Agent already exists’], 204); } else { $user = Agent::where(‘phone’, $request->phone)->first(); $input = $request->all(); $input[‘type’]…

Details