I am trying to build a custom configuration that gets added to my Laravel configuration at boot up. I created an artisan command that allows the developers to place the server into 'test' mode and 'live' mode. This should then force API's to use test keys rather than live keys which works fine.
public function handle()
{
switch(strtoupper($this->argument('m'))) {
case 'LIVE':
\DB::table('server_mode')->where('id', 1)->update([
'mode' => true,
'verified_by' => 'Server'
]);
$this->info('Server is now in LIVE mode');
break;
case 'TEST':
\DB::table('server_mode')->where('id', 1)->update([
'mode' => false,
'verified_by' => 'Server'
]);
$this->info('Server is now in TEST mode');
break;
default:
$this->error('Please enter either LIVE or TEST');
break;
}
}
The problem is, I want to add which developer changed the status. So far, it is hard coded to 'Server'. Is it possible to get the IP or PC information who'm executed the command to store in the DB?