Merge pull request #87 from ControlPanel-gg/extra_config_options

added descriptions to config seeds
This commit is contained in:
AVMG 2021-06-22 21:26:13 +02:00 committed by GitHub
commit 2bf64ec8b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 21 deletions

View file

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin; namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Configuration;
use App\Models\Payment; use App\Models\Payment;
use App\Models\PaypalProduct; use App\Models\PaypalProduct;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
@ -20,15 +21,11 @@ use PayPalHttp\HttpException;
class PaymentController extends Controller class PaymentController extends Controller
{ {
protected $allowedAmounts = [ /**
'87', * @return Application|Factory|View
'350', */
'1000', public function index()
'2000', {
'4000'
];
public function index(){
return view('admin.payments.index')->with([ return view('admin.payments.index')->with([
'payments' => Payment::paginate(15) 'payments' => Payment::paginate(15)
]); ]);
@ -51,17 +48,17 @@ class PaymentController extends Controller
* @param PaypalProduct $paypalProduct * @param PaypalProduct $paypalProduct
* @return RedirectResponse * @return RedirectResponse
*/ */
public function pay(Request $request , PaypalProduct $paypalProduct) public function pay(Request $request, PaypalProduct $paypalProduct)
{ {
$request = new OrdersCreateRequest(); $request = new OrdersCreateRequest();
$request->prefer('return=representation'); $request->prefer('return=representation');
$request->body = [ $request->body = [
"intent" => "CAPTURE", "intent" => "CAPTURE",
"purchase_units" => [ "purchase_units" => [
[ [
"reference_id" => uniqid(), "reference_id" => uniqid(),
"amount" => [ "amount" => [
"value" => $paypalProduct->price, "value" => $paypalProduct->price,
"currency_code" => strtoupper($paypalProduct->currency_code) "currency_code" => strtoupper($paypalProduct->currency_code)
] ]
] ]
@ -69,7 +66,7 @@ class PaymentController extends Controller
"application_context" => [ "application_context" => [
"cancel_url" => route('payment.cancel'), "cancel_url" => route('payment.cancel'),
"return_url" => route('payment.success', ['product' => $paypalProduct->id]), "return_url" => route('payment.success', ['product' => $paypalProduct->id]),
'brand_name' => config('app.name', 'Laravel') , 'brand_name' => config('app.name', 'Laravel'),
] ]
]; ];
@ -133,8 +130,10 @@ class PaymentController extends Controller
Auth::user()->increment('credits', $paypalProduct->quantity); Auth::user()->increment('credits', $paypalProduct->quantity);
//update server limit //update server limit
if (Auth::user()->server_limit < 10) { if (Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE', 10) !== 0) {
Auth::user()->update(['server_limit' => 10]); if (Auth::user()->server_limit < Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE', 10)) {
Auth::user()->update(['server_limit' => 10]);
}
} }
//update role //update role

View file

@ -16,6 +16,7 @@ class StoreController extends Controller
{ {
$isPaypalSetup = false; $isPaypalSetup = false;
if (env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID')) $isPaypalSetup = true; if (env('PAYPAL_SECRET') && env('PAYPAL_CLIENT_ID')) $isPaypalSetup = true;
if (env('APP_ENV' , 'local') == 'local') $isPaypalSetup = true;
return view('store.index')->with([ return view('store.index')->with([
'products' => PaypalProduct::where('disabled' , '=' , false)->orderBy('price' , 'asc')->get(), 'products' => PaypalProduct::where('disabled' , '=' , false)->orderBy('price' , 'asc')->get(),

View file

@ -80,7 +80,7 @@ class ConfigurationSeeder extends Seeder
], [ ], [
'value' => '10', 'value' => '10',
'type' => 'integer', 'type' => 'integer',
'description' => 'Sets the users server limit to this amount after purchasing with money, set to 0 to ignore this.', 'description' => 'updates the users server limit to this amount (unless the user already has a higher server limit) after making a purchase with real money, set to 0 to ignore this.',
]); ]);
} }
} }

View file

@ -40,7 +40,7 @@
<th>Key</th> <th>Key</th>
<th>Value</th> <th>Value</th>
<th>Type</th> <th>Type</th>
<th>Description</th> <th width="600">Description</th>
<th>Created at</th> <th>Created at</th>
<th></th> <th></th>
</tr> </tr>

View file

@ -59,10 +59,10 @@
@else @else
<div class="alert alert-danger alert-dismissible"> <div class="alert alert-danger alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-ban"></i> @if($products->count() == 0) The store is temporarily <h4><i class="icon fa fa-ban"></i> @if($products->count() == 0) There are no store products! @else The store is not correctly configured! @endif
disabled! @else The store is not correctly configured! @endif
</h4> </h4>
</div> </div>
@endif @endif