SMART Plan — Set cron/scheduled task frequency in System Settings
Specific
A Select field labelled "Recurring Invoice Frequency" in the System tab of the Company Settings page. Options: daily, weekly, monthly. Stores the selected value as a string under the key cron_frequency, scoped to the current company. Controls how often the Laravel scheduler runs the recurring invoice generation job for this company.
Measurable
- The field appears in the System section of the Company Settings page
- Saving the form persists the value to the
settings table with key cron_frequency and company_id scope
- The value is read back correctly on page reload
- The scheduler reads this setting to determine the recurrence interval for this company's recurring invoices
Achievable
- Create/extend
Modules/Core/Filament/Company/Pages/CompanySettings.php (Filament page with tabs)
- Add a
Select::make('cron_frequency')->label('Recurring Invoice Frequency')->options(['daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly']) field to the System tab section
- Add
const CRON_FREQUENCY = 'cron_frequency'; to Modules/Core/Models/Setting.php constants
- Register the page in
CompanyPanelProvider
Relevant
Different companies have different invoicing cadences. A weekly-billing agency and a monthly-subscription SaaS both need recurring invoices, but at different intervals. Per-company control avoids running unnecessary jobs and prevents over- or under-billing.
Time-bound
Sprint 6.
Arrange · Act · Assert
// Modules/Core/Tests/Feature/CompanySettingsTest.php
#[Test]
public function it_saves_cron_frequency_setting(): void
{
/* Arrange */
$page = Livewire::actingAs($this->user)
->test(\Modules\Core\Filament\Company\Pages\CompanySettings::class);
/* Act */
$page->set('data.cron_frequency', 'weekly')
->call('save');
/* Assert */
$page->assertSuccessful();
$this->assertDatabaseHas('settings', [
'company_id' => $this->company->id,
'key' => 'cron_frequency',
'value' => 'weekly',
]);
}
SMART Plan — Set cron/scheduled task frequency in System Settings
Specific
A Select field labelled "Recurring Invoice Frequency" in the System tab of the Company Settings page. Options:
daily,weekly,monthly. Stores the selected value as a string under the keycron_frequency, scoped to the current company. Controls how often the Laravel scheduler runs the recurring invoice generation job for this company.Measurable
settingstable with keycron_frequencyand company_id scopeAchievable
Modules/Core/Filament/Company/Pages/CompanySettings.php(Filament page with tabs)Select::make('cron_frequency')->label('Recurring Invoice Frequency')->options(['daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly'])field to the System tab sectionconst CRON_FREQUENCY = 'cron_frequency';toModules/Core/Models/Setting.phpconstantsCompanyPanelProviderRelevant
Different companies have different invoicing cadences. A weekly-billing agency and a monthly-subscription SaaS both need recurring invoices, but at different intervals. Per-company control avoids running unnecessary jobs and prevents over- or under-billing.
Time-bound
Sprint 6.
Arrange · Act · Assert