Remove global minimum‑credits setting and enforce per‑product minimums#1313
Merged
1day2die merged 4 commits intoCtrlpanel-gg:developmentfrom Mar 12, 2026
Merged
Remove global minimum‑credits setting and enforce per‑product minimums#13131day2die merged 4 commits intoCtrlpanel-gg:developmentfrom
1day2die merged 4 commits intoCtrlpanel-gg:developmentfrom
Conversation
- Updated product views to directly use `display_minimum_credits` for better clarity. - Adjusted server creation view to reflect changes in minimum credits logic, utilizing `effective_minimum` for credit checks. - Enhanced server settings view for improved readability and consistency in label formatting. - Introduced a migration to normalize `minimum_credits` values, ensuring they align with product pricing. - Removed the global minimum credits setting from the database to streamline configuration.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the global “minimum credits to create a server” setting and makes server/product minimum-credit behavior derive from each product (defaulting to product price when unset), with corresponding UI/API updates and data migrations.
Changes:
- Removes
user.min_credits_to_make_serverfrom settings and updates UI to rely on product-level minimum credits (defaulting to price). - Enforces
minimum_credits >= pricein admin + API validation, and updates display helpers/resources to fall back to price. - Adds migrations to delete the old setting row and normalize existing
products.minimum_creditsvalues.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| themes/default/views/servers/settings.blade.php | Formatting + upgrade modal text/UI adjustments. |
| themes/default/views/servers/create.blade.php | Uses product-derived effective minimum credits for create button gating/display. |
| themes/default/views/admin/products/show.blade.php | Displays product minimum credits via display_minimum_credits. |
| themes/default/views/admin/products/edit.blade.php | Updates minimum credits help text + form null-handling. |
| themes/default/views/admin/products/create.blade.php | Same as edit: help text + null-handling. |
| lang/en.json | Adds new minimum-credits help text key + formatting fix. |
| database/settings/2026_02_02_182405_remove_min_credits_setting.php | Deletes the legacy global min-credits setting row. |
| database/migrations/2026_02_02_175351_migrate_product_minimum_credits_values.php | Normalizes product minimum credits to be at least price + adds backup column. |
| app/Settings/UserSettings.php | Removes min_credits_to_make_server setting/validation/option metadata. |
| app/Services/ServerCreationService.php | Server creation credit check now uses product price when minimum is unset. |
| app/Models/Product.php | display_minimum_credits now falls back to price for NULL/-1. |
| app/Listeners/UnsuspendServers.php | Refactors unsuspend flow into a transaction with locked user row and per-server deductions. |
| app/Http/Resources/ProductResource.php | API resource now returns minimum credits with fallback to price for NULL/-1. |
| app/Http/Requests/Api/Products/CreateProductRequest.php | Adds gte:price for minimum_credits. |
| app/Http/Requests/Api/Products/UpdateProductRequest.php | Adds gte:price for minimum_credits. |
| app/Http/Controllers/ServerController.php | Removes global min-credits usage; updates error message i18n. |
| app/Http/Controllers/Admin/SettingsController.php | Stops converting/storing removed global min-credits setting. |
| app/Http/Controllers/Admin/ProductController.php | Enforces minimum_credits >= price, removes global fallback in show/datatable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…sure fallback to price for null or invalid values.
…n remote call failure and log exceptions for investigation.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ing and UI consistency The changes across files address: - **UpdateProductRequest.php**: Enforce price requirement when updating minimum_credits - **UnsuspendServers.php**: Optimize loop with `break`, add proper error logging - **Settings migration**: Follow Spatie conventions with rollback support - **Views**: Remove invalid HTML (`target="__blank"`), redundant tokens, and fix button styling inconsistencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
minimum_creditsvalues so they follow the new rules:-1) → set topriceminimum_credits<price→ set topricepriceremain unchangedWhat changed
minimum_creditsmust be >=priceon product create/update. (ProductController.php, API requests)2026_02_02_175351_migrate_product_minimum_credits_values.phpnormalises old values.user.min_credits_to_make_serverand property removed fromUserSettings.php.Productaccessor and blade views display/use effective minimum; updated UI text and language entries. (Product.php,themes/default/views/..., en.json)down()restores the backed‑up column.Upgrade / deploy notes
productsdata).Related