/** * Execute the console command. * * @param PerformanceIndicatorsRepository $indicators * @return mixed */ public function handle(PerformanceIndicatorsRepository $indicators) { DB::table('performance_indicators')->insert(['monthly_recurring_revenue' => $indicators->monthlyRecurringRevenue(), 'yearly_recurring_revenue' => $indicators->yearlyRecurringRevenue(), 'daily_volume' => DB::table('invoices')->whereDate('created_at', '=', Carbon::today())->sum('total'), 'new_users' => DB::table('users')->whereDate('created_at', '=', Carbon::today())->count(), 'created_at' => Carbon::today(), 'updated_at' => Carbon::today()]); $this->info('Performance indicators stored!'); }
/** * Get the revenue amounts for the application. * * @return Response */ public function revenue() { return ['yearlyRecurringRevenue' => $this->indicators->yearlyRecurringRevenue(), 'monthlyRecurringRevenue' => $this->indicators->monthlyRecurringRevenue(), 'totalVolume' => $this->indicators->totalVolume()]; }