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

Java: Can I initialize a function directly without converting it to a variable?

For the first code: findContact(String name) did not return any contact rather it returned “Error in finding contact”). FIRST CODE DID NOT WORK: public Contacts findContact(String name) { for (int i = 0; i < contactsArray.size(); i++) { if (contactsArray.get(i).getName().equals(name)) { // USED IT DIRECTLY return contactsArray.get(i); } else { System.out.println(“Error in finding contact”); }…

Details

variable error in function while assignment

Write a Python script to sort (ascending and descending) a dictionary by value def sort_dictionary_ascending(dict): flag = True list = [] while(len(dict)!=1): flag = True for x,y in dict.items(): if flag: min = x flag = False elif min>x: min =x; list.append(min) dict.pop(min) min,value= dict.popitem() list.append(min) print(list) def sort_dictionary_descending(dict): flag = True list = []…

Details

Replace URL String with Integer characters located in the end of that String

I have some URL link and tried to replace all non-integer values with integers in the end of the link using regex The URL is something like https://some.storage.com/test123456.bucket.com/folder/80.png Regex i tried to use: Integer.parseInt(string.replaceAll(“.*[^\\d](\\d+)”, “$1″)) Output for that regex is “80.png”, and i need only “80”. Also i tried this tool – https://regex101.com. And as…

Details