How to get user's IP address in Laravel?

0 votes
How to know the ip address of the user in laravel those who have visited my website?
Mar 20 in Laravel by kartik
• 4,560 points
26 views

1 answer to this question.

0 votes

Hey,

We can get the user's IP address using:

public function getUserIp(Request $request){  

            // Gettingip address of remote user  

            return $user_ip_address=$request->ip();  

}  

Hope this will be helpful!

Thank you!!

answered Mar 20 by Niroj
• 8,620 points

Related Questions In Laravel

0 votes
1 answer

How to get a list of registered route paths in Laravel?

Hello, Route::getRoutes() returns a RouteCollection. On each element, you can ...READ MORE

answered 4 days ago in Laravel by Niroj
• 8,620 points
79 views
0 votes
1 answer

How to pass URL param in Laravel?

Hello, First you have to go to routes ...READ MORE

answered Mar 18 in Laravel by Niroj
• 8,620 points
33 views
0 votes
1 answer

How to pass data through URL and access through controller in Laravel?

Hello, You can  first refer how to  Create controller through ...READ MORE

answered Mar 18 in Laravel by Niroj
• 8,620 points
43 views
0 votes
1 answer

How to mock a static facade methods in Laravel?

Hey, Facades provide a "static" interface to classes ...READ MORE

answered Mar 19 in Laravel by Niroj
• 8,620 points
26 views
0 votes
1 answer

How to download and install Lavavel framework?

Hey @kartik, First you must have xampp install ...READ MORE

answered Mar 17 in Laravel by Niroj
• 8,620 points
30 views
0 votes
1 answer

Display Laravel in browser by using cmd promt?

Hello, First you need to have laravel install ...READ MORE

answered Mar 17 in Laravel by Niroj
• 8,620 points
19 views
0 votes
1 answer

How can we get started with Laravel through Xampp?

Hii, First you need to start Apache and ...READ MORE

answered Mar 17 in Laravel by Niroj
• 8,620 points
21 views
0 votes
1 answer

How to change Laravel official name to any customize name?

Hey, You just need to go Laravel folder through ...READ MORE

answered Mar 17 in Laravel by Niroj
• 8,620 points
14 views
0 votes
1 answer

How to identify wheather the request is HTTP GET or HTTP POST in Laravel?

Hey, In order to identify the type of ...READ MORE

answered Mar 19 in Laravel by Niroj
• 8,620 points
22 views
0 votes
1 answer

How to get distinct values for non-key column fields in Laravel?

Hello @kartik In eloquent you can use this $users ...READ MORE

answered 5 days ago in Laravel by Niroj
• 8,620 points
13 views