command reminder add check company has action
This commit is contained in:
parent
b2062a052b
commit
b1d3f0bb8b
@ -36,9 +36,14 @@ class BillReminder extends Command
|
|||||||
config(['laravel-model-caching.enabled' => false]);
|
config(['laravel-model-caching.enabled' => false]);
|
||||||
|
|
||||||
// Get all companies
|
// Get all companies
|
||||||
$companies = Company::enabled()->cursor();
|
$companies = Company::enabled()->withCount('bills')->cursor();
|
||||||
|
|
||||||
foreach ($companies as $company) {
|
foreach ($companies as $company) {
|
||||||
|
// Has company bills
|
||||||
|
if (!$company->bills_count) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->info('Sending bill reminders for ' . $company->name . ' company.');
|
$this->info('Sending bill reminders for ' . $company->name . ' company.');
|
||||||
|
|
||||||
// Set company id
|
// Set company id
|
||||||
|
@ -36,9 +36,14 @@ class InvoiceReminder extends Command
|
|||||||
config(['laravel-model-caching.enabled' => false]);
|
config(['laravel-model-caching.enabled' => false]);
|
||||||
|
|
||||||
// Get all companies
|
// Get all companies
|
||||||
$companies = Company::enabled()->cursor();
|
$companies = Company::enabled()->withCount('invoices')->cursor();
|
||||||
|
|
||||||
foreach ($companies as $company) {
|
foreach ($companies as $company) {
|
||||||
|
// Has company invoices
|
||||||
|
if (!$company->invoices_count) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->info('Sending invoice reminders for ' . $company->name . ' company.');
|
$this->info('Sending invoice reminders for ' . $company->name . ' company.');
|
||||||
|
|
||||||
// Set company id
|
// Set company id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user