has('database_created')) { $schedule->command('check:invoices:status') ->daily(); $schedule->command('check:estimates:status') ->daily(); $recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get(); foreach ($recurringInvoices as $recurringInvoice) { $schedule->call(function () use ($recurringInvoice) { $recurringInvoice->generateInvoice(); })->cron($recurringInvoice->frequency); } } } /** * Register the Closure based commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } }