Get the nid from current URL after the ? for views argument
Just put $_GET['gids'] this will return you an array in PHP.
Then if there's only one nid you can make:

$gids = $_GET['gids'];
return $gids[0];


Source: How to get PHP $_GET array?