Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel get ip in controller

$mytime = CarbonCarbon::now()->format('H:i d-m-Y ');
$ip = request()->ip();

 {{ucwords($mytime)}}  {{ucwords(request()->ip())}}
<div style="float:left;">{{ucwords(request()->ip())}}</div>
Comment

get ip in laravel

request()->ip();
Comment

get ip address in laravel

public function getUserIpAddr(){
       $ipaddress = '';
       if (isset($_SERVER['HTTP_CLIENT_IP']))
           $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
       else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
           $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
       else if(isset($_SERVER['HTTP_X_FORWARDED']))
           $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
       else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
           $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
       else if(isset($_SERVER['HTTP_FORWARDED']))
           $ipaddress = $_SERVER['HTTP_FORWARDED'];
       else if(isset($_SERVER['REMOTE_ADDR']))
           $ipaddress = $_SERVER['REMOTE_ADDR'];
       else
           $ipaddress = 'UNKNOWN';    
       return $ipaddress;
    }
Comment

PREVIOUS NEXT
Code Example
Php :: func_get_args with keys 
Php :: how to remove additional sidebar in magento 2 using xml 
Php :: formdata jquery ajax php 
Php :: php upload file via curl 
Php :: php get domain name with https 
Php :: confirm password validation laravel 
Php :: bindings laravel 
Php :: laravel string builder 
Php :: delete all rows from table laravel 
Php :: php datetime to timestamp 
Php :: cmd run powershell command 
Php :: php remove all parameter from url 
Php :: bind in pdo 
Php :: pdo php check if row exist 
Php :: php ini_set timeout 
Php :: wp display custom fields 
Php :: php get timezone 
Php :: laravel inverse seeder 
Php :: integer nullable laravel 
Php :: get number of chars ina string php 
Php :: laravel middleware check if user is logged in 
Php :: how unset request parameter in laravel 
Php :: laravel table in model 
Php :: eloquent get query log 
Php :: laravel url previous 
Php :: difference between fetch assoc and fetch array or object php 
Php :: php bubble sort 
Php :: current URL without url site laravel 
Php :: PHP strtoupper() Function 
Php :: artisan mograte particular tabel 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =