Skip to content

Commit 47edb44

Browse files
committed
Implement GeneralSettings class for data cap configuration and update migration for data cap settings
1 parent 1ee9b8b commit 47edb44

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

app/Settings/GeneralSettings.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace App\Settings;
4+
5+
use Spatie\LaravelSettings\Settings;
6+
7+
class GeneralSettings extends Settings
8+
{
9+
public string $data_cap_data_limit = ''; // Example: '500GB' or '1TB'
10+
11+
public string $data_cap_period = 'monthly'; // Options: 'daily', 'monthly', 'weekly'
12+
13+
public int $data_cap_reset_day = 1; // Day of the month to reset data cap
14+
15+
public int $data_cap_warning_percentage = 80; // Percentage to notify user
16+
17+
public string $data_cap_action = 'notify'; // Options: 'notify', 'restrict'
18+
19+
public static function group(): string
20+
{
21+
return 'general';
22+
}
23+
}

database/settings/2025_11_29_123344_create_general_settings.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
{
77
public function up(): void
88
{
9-
$this->migrator->add('general.data_cap_enabled', false);
10-
$this->migrator->add('general.data_cap_data_limit', null); // Example: '500GB' or '1TB'
9+
$this->migrator->add('general.data_cap_data_limit', ''); // Example: '500GB' or '1TB'
1110
$this->migrator->add('general.data_cap_period', 'monthly'); // Options: 'daily', 'monthly', 'weekly'
1211
$this->migrator->add('general.data_cap_reset_day', 1); // Day of the month to reset data cap
1312
$this->migrator->add('general.data_cap_warning_percentage', 80); // Percentage to notify user
14-
$this->migrator->add('general.data_cap_action', 'notify'); // Options: 'notify', 'restrict'
13+
$this->migrator->add('general.data_cap_action', 'notify'); // Options: 'notify', 'block'
1514
}
1615
};

0 commit comments

Comments
 (0)