How can we get the IP address of the user in Laravel ?
Hello friend in this post I going to show you how to get users Ip address in Laravel 5.4 and save it is database.
public function trackUserActivity(Request $request){
$user_activity=new UserActivity();
// getting logged in user info from laravel Auth
$user_activity->user_id=Auth::id();
// Getting ip address of remote user
$user_activity->ip_address=$requeest->ip();
$user_activity->save();
}
Hello friend in this post I going to show you how to get users Ip address in Laravel 5.4 and save it is database.
public function trackUserActivity(Request $request){
$user_activity=new UserActivity();
// getting logged in user info from laravel Auth
$user_activity->user_id=Auth::id();
// Getting ip address of remote user
$user_activity->ip_address=$requeest->ip();
$user_activity->save();
}
No comments