diff --git a/app/Console/Commands/CalculatePayouts.php b/app/Console/Commands/CalculatePayouts.php index 154d3dce9916..3d400d52de24 100644 --- a/app/Console/Commands/CalculatePayouts.php +++ b/app/Console/Commands/CalculatePayouts.php @@ -42,7 +42,6 @@ class CalculatePayouts extends Command */ public function handle() { - $this->info('Running CalculatePayouts...'); $type = strtolower($this->option('type')); switch ($type) { @@ -61,7 +60,6 @@ class CalculatePayouts extends Command $userMap = []; foreach ($servers as $server) { - $this->info('Processing users: ' . $server->name); config(['database.default' => $server->name]); $users = User::where('referral_code', '!=', '') @@ -72,7 +70,6 @@ class CalculatePayouts extends Command } foreach ($servers as $server) { - $this->info('Processing companies: ' . $server->name); config(['database.default' => $server->name]); $companies = Company::where('referral_code', '!=', '') @@ -80,6 +77,8 @@ class CalculatePayouts extends Command ->whereNotNull('payment_id') ->get(); + $this->info('User,Client,Date,Amount,Reference'); + foreach ($companies as $company) { if (!isset($userMap[$company->referral_code])) { continue; @@ -91,12 +90,14 @@ class CalculatePayouts extends Command if ($payment) { $client = $payment->client; - $this->info("User: $user"); - $this->info("Client: " . $client->getDisplayName()); - foreach ($client->payments as $payment) { $amount = $payment->getCompletedAmount(); - $this->info("Date: $payment->payment_date, Amount: $amount, Reference: $payment->transaction_reference"); + $this->info('"' . $user . '",' . + '"' . $client->getDisplayName() . '",' . + $payment->payment_date . ',' . + $amount . ',' . + $payment->transaction_reference + ); } } }