diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php index 2facf165..d16a765e 100644 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ b/app/Http/Controllers/Admin/ConfigurationController.php @@ -112,7 +112,7 @@ class ConfigurationController extends Controller return datatables($query) ->addColumn('actions', function (Configuration $configuration) { - return ' '; + return ' '; }) ->editColumn('created_at', function (Configuration $configuration) { return $configuration->created_at ? $configuration->created_at->diffForHumans() : ''; diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index 110d2c0d..a7001427 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -141,12 +141,12 @@ class PaymentController extends Controller $user->increment('credits', $paypalProduct->quantity); //update server limit - if (Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE', 10) !== 0) { - if ($user->server_limit < Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE', 10)) { - $user->update(['server_limit' => 10]); + if (Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) { + if ($user->server_limit < Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')) { + $user->update(['server_limit' => Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE')]); } } - + //update role if ($user->role == 'member') { $user->update(['role' => 'client']); diff --git a/app/Http/Controllers/Admin/ProductController.php b/app/Http/Controllers/Admin/ProductController.php index 97407644..ffa6856b 100644 --- a/app/Http/Controllers/Admin/ProductController.php +++ b/app/Http/Controllers/Admin/ProductController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; +use App\Models\Configuration; use App\Models\Product; use Exception; use Illuminate\Contracts\Foundation\Application; @@ -51,6 +52,7 @@ class ProductController extends Controller "swap" => "required|numeric|max:1000000|min:0", "description" => "required|string|max:191", "disk" => "required|numeric|max:1000000|min:5", + "minimum_credits" => "required|numeric|max:1000000|min:-1", "io" => "required|numeric|max:1000000|min:0", "databases" => "required|numeric|max:1000000|min:0", "backups" => "required|numeric|max:1000000|min:0", @@ -73,7 +75,8 @@ class ProductController extends Controller public function show(Product $product) { return view('admin.products.show', [ - 'product' => $product + 'product' => $product, + 'minimum_credits' => Configuration::getValueByKey("MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER"), ]); } @@ -108,6 +111,7 @@ class ProductController extends Controller "description" => "required|string|max:191", "disk" => "required|numeric|max:1000000|min:5", "io" => "required|numeric|max:1000000|min:0", + "minimum_credits" => "required|numeric|max:1000000|min:-1", "databases" => "required|numeric|max:1000000|min:0", "backups" => "required|numeric|max:1000000|min:0", "allocations" => "required|numeric|max:1000000|min:0", @@ -125,7 +129,8 @@ class ProductController extends Controller * @param Product $product * @return RedirectResponse */ - public function disable(Request $request, Product $product) { + public function disable(Request $request, Product $product) + { $product->update(['disabled' => !$product->disabled]); return redirect()->route('admin.products.index')->with('success', 'product has been updated!'); @@ -181,12 +186,11 @@ class ProductController extends Controller ' . csrf_field() . ' ' . method_field("PATCH") . '