l2t

How to Get IP Address in Laravel?

Asked: 25 days ago

There are few different methods using which you can retrive client ip address.

# Example-1: Getting ip address in controller
$clientIP = request()->ip();   

# Example:2: Getting ip in other classes
$clientIP = Request::ip()
$clientIP = Request::getClientIp(true);


# Example-3: Getting ip in blade view
{{ Request::ip() }}
Viewed: 57 times
Liked: 1 times