Files
InvoiceShelf/routes/console.php
Darko Gjorgjijoski 947d00a9f1 refactor(services): Documents→Document + ExchangeRate→Integrations/ExchangeRate
Two follow-ups to the Services reorg that landed in 6d1816bd.

**Documents → Document** (singular). Documents/ was the only plural subdir in app/Services/ — every other bucket (Company, Mail, Module, Pdf, Storage, Update, ExchangeRate) was singular. Renaming to Document/ normalizes the whole tree.

**ExchangeRate → Integrations/ExchangeRate**. Introduces Integrations/ as an umbrella for external-service adapter subsystems. Exchange rate providers move in first; AI providers, payment gateways, and any other driver-pattern integrations land as sibling subdirs (Integrations/Ai/, Integrations/Payment/) without another reorg. Integrations/ was chosen over Providers/ to avoid conceptual collision with Laravel's app/Providers/ — 'check the providers' shouldn't be ambiguous.

17 files moved, 21 consumer files rewritten to point at the new namespaces via literal-string replacement (same approach as the previous reorg). 350 tests pass, Pint clean.
2026-04-11 11:30:00 +02:00

33 lines
1011 B
PHP

<?php
use App\Models\CompanySetting;
use App\Models\RecurringInvoice;
use App\Services\Document\RecurringInvoiceService;
use App\Support\Setup\InstallUtils;
use Illuminate\Support\Facades\Schedule;
// Only run in demo environment
if (config('app.env') === 'demo') {
Schedule::command('reset:app --force')
->daily()
->runInBackground()
->withoutOverlapping();
}
if (InstallUtils::isDbCreated()) {
Schedule::command('check:invoices:status')
->daily();
Schedule::command('check:estimates:status')
->daily();
$recurringInvoices = RecurringInvoice::where('status', 'ACTIVE')->get();
foreach ($recurringInvoices as $recurringInvoice) {
$timeZone = CompanySetting::getSetting('time_zone', $recurringInvoice->company_id);
Schedule::call(function () use ($recurringInvoice) {
app(RecurringInvoiceService::class)->generateInvoice($recurringInvoice);
})->cron($recurringInvoice->frequency)->timezone($timeZone);
}
}