How to Get Client IP Address in Laravel 6 With Example?

Hello Friends Today, through this Tutorial, I will tell you how you can get the ip address of any client by Laravel 6.

There are some inbuilt funtion in Laravel 6, which we can easily get any value only by using it.

\Request :: ip (); These are the inbuilt funtion of Laravel, which we can use in controller to get client ip address.

I will tell you 2 ways to get client ip address in Laravel 6, so let’s go

Example 1 :-

$clientIP = \Request::ip();

Example 2:-

public function index(Request $request)
{
return $request->ip();
}

Leave a Reply

Your email address will not be published. Required fields are marked *