Merge pull request #424 from ControlPanel-gg/development
Ability to buy more server slots and some fixes
This commit is contained in:
commit
20d05cf114
|
@ -1,151 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Models\Egg;
|
|
||||||
use App\Models\Nest;
|
|
||||||
use Exception;
|
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Class NestsController
|
|
||||||
* @package App\Http\Controllers\Admin
|
|
||||||
*/
|
|
||||||
class NestsController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return Application|Factory|View
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return view('admin.nests.index');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*
|
|
||||||
* @param Nest $nest
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function show(Nest $nest)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*
|
|
||||||
* @param Nest $nest
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function edit(Nest $nest)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param Nest $nest
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
|
||||||
public function update(Request $request, Nest $nest)
|
|
||||||
{
|
|
||||||
$disabled = !!is_null($request->input('disabled'));
|
|
||||||
$nest->update(['disabled' => $disabled]);
|
|
||||||
|
|
||||||
return redirect()->back()->with('success', 'Nest updated');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param Nest $nest
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function destroy(Nest $nest)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function sync(){
|
|
||||||
Egg::query()->delete();
|
|
||||||
Nest::query()->delete();
|
|
||||||
Nest::syncNests();
|
|
||||||
Egg::syncEggs();
|
|
||||||
|
|
||||||
|
|
||||||
return redirect()->back()->with('success', 'Nests and Eggs have been synced');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Request $request
|
|
||||||
* @return JsonResponse|mixed
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function dataTable(Request $request)
|
|
||||||
{
|
|
||||||
$query = Nest::with(['eggs']);
|
|
||||||
$query->select('nests.*');
|
|
||||||
|
|
||||||
return datatables($query)
|
|
||||||
->addColumn('eggs', function (Nest $nest) {
|
|
||||||
return $nest->eggs()->count();
|
|
||||||
})
|
|
||||||
->addColumn('actions', function (Nest $nest) {
|
|
||||||
$checked = $nest->disabled == false ? "checked" : "";
|
|
||||||
return '
|
|
||||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.nests.update', $nest->id) . '">
|
|
||||||
' . csrf_field() . '
|
|
||||||
' . method_field("PATCH") . '
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input '.$checked.' name="disabled" onchange="this.form.submit()" type="checkbox" class="custom-control-input" id="switch'.$nest->id.'">
|
|
||||||
<label class="custom-control-label" for="switch'.$nest->id.'"></label>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
';
|
|
||||||
})
|
|
||||||
->editColumn('created_at' , function (Nest $nest) {
|
|
||||||
return $nest->created_at ? $nest->created_at->diffForHumans() : '';
|
|
||||||
})
|
|
||||||
->rawColumns(['actions'])
|
|
||||||
->make();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,149 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use App\Models\Location;
|
|
||||||
use App\Models\Node;
|
|
||||||
use Exception;
|
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
|
||||||
use Illuminate\Contracts\View\Factory;
|
|
||||||
use Illuminate\Contracts\View\View;
|
|
||||||
use Illuminate\Http\JsonResponse;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* Class NodeController
|
|
||||||
* @package App\Http\Controllers\Admin
|
|
||||||
*/
|
|
||||||
class NodeController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return Application|Factory|View
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return view('admin.nodes.index');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*
|
|
||||||
* @param Node $node
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function show(Node $node)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*
|
|
||||||
* @param Node $node
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function edit(Node $node)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param Request $request
|
|
||||||
* @param Node $node
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
|
||||||
public function update(Request $request, Node $node)
|
|
||||||
{
|
|
||||||
$disabled = !!is_null($request->input('disabled'));
|
|
||||||
$node->update(['disabled' => $disabled]);
|
|
||||||
|
|
||||||
return redirect()->back()->with('success', 'Node updated');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param Node $node
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function destroy(Node $node)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function sync(){
|
|
||||||
Node::query()->delete();
|
|
||||||
Location::query()->delete();
|
|
||||||
Node::syncNodes();
|
|
||||||
|
|
||||||
return redirect()->back()->with('success', 'Locations and Nodes have been synced');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Request $request
|
|
||||||
* @return JsonResponse|mixed
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function dataTable(Request $request)
|
|
||||||
{
|
|
||||||
$query = Node::with(['location']);
|
|
||||||
$query->select('nodes.*');
|
|
||||||
|
|
||||||
return datatables($query)
|
|
||||||
->addColumn('location', function (Node $node) {
|
|
||||||
return $node->location->name;
|
|
||||||
})
|
|
||||||
->addColumn('actions', function (Node $node) {
|
|
||||||
$checked = $node->disabled == false ? "checked" : "";
|
|
||||||
return '
|
|
||||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.nodes.update', $node->id) . '">
|
|
||||||
' . csrf_field() . '
|
|
||||||
' . method_field("PATCH") . '
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input '.$checked.' name="disabled" onchange="this.form.submit()" type="checkbox" class="custom-control-input" id="switch'.$node->id.'">
|
|
||||||
<label class="custom-control-label" for="switch'.$node->id.'"></label>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
';
|
|
||||||
})
|
|
||||||
->editColumn('created_at' , function (Node $node) {
|
|
||||||
return $node->created_at ? $node->created_at->diffForHumans() : '';
|
|
||||||
})
|
|
||||||
->rawColumns(['actions'])
|
|
||||||
->make();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,7 +23,7 @@ class OverViewController extends Controller
|
||||||
});
|
});
|
||||||
|
|
||||||
$creditCount = Cache::remember('credit:count', self::TTL, function () {
|
$creditCount = Cache::remember('credit:count', self::TTL, function () {
|
||||||
return User::query()->sum('credits');
|
return User::query()->where("role","!=","admin")->sum('credits');
|
||||||
});
|
});
|
||||||
|
|
||||||
$paymentCount = Cache::remember('payment:count', self::TTL, function () {
|
$paymentCount = Cache::remember('payment:count', self::TTL, function () {
|
||||||
|
|
|
@ -6,7 +6,7 @@ use App\Events\UserUpdateCreditsEvent;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\InvoiceSettings;
|
use App\Models\InvoiceSettings;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\CreditProduct;
|
use App\Models\ShopProduct;
|
||||||
use App\Models\Settings;
|
use App\Models\Settings;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\InvoiceNotification;
|
use App\Notifications\InvoiceNotification;
|
||||||
|
@ -49,25 +49,25 @@ class PaymentController extends Controller
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return Application|Factory|View
|
* @return Application|Factory|View
|
||||||
*/
|
*/
|
||||||
public function checkOut(Request $request, CreditProduct $creditProduct)
|
public function checkOut(Request $request, ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
return view('store.checkout')->with([
|
return view('store.checkout')->with([
|
||||||
'product' => $creditProduct,
|
'product' => $shopProduct,
|
||||||
'taxvalue' => $creditProduct->getTaxValue(),
|
'taxvalue' => $shopProduct->getTaxValue(),
|
||||||
'taxpercent' => $creditProduct->getTaxPercent(),
|
'taxpercent' => $shopProduct->getTaxPercent(),
|
||||||
'total' => $creditProduct->getTotalPrice()
|
'total' => $shopProduct->getTotalPrice()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function PaypalPay(Request $request, CreditProduct $creditProduct)
|
public function PaypalPay(Request $request, ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
$request = new OrdersCreateRequest();
|
$request = new OrdersCreateRequest();
|
||||||
$request->prefer('return=representation');
|
$request->prefer('return=representation');
|
||||||
|
@ -76,20 +76,20 @@ class PaymentController extends Controller
|
||||||
"purchase_units" => [
|
"purchase_units" => [
|
||||||
[
|
[
|
||||||
"reference_id" => uniqid(),
|
"reference_id" => uniqid(),
|
||||||
"description" => $creditProduct->description,
|
"description" => $shopProduct->description,
|
||||||
"amount" => [
|
"amount" => [
|
||||||
"value" => $creditProduct->getTotalPrice(),
|
"value" => $shopProduct->getTotalPrice(),
|
||||||
'currency_code' => strtoupper($creditProduct->currency_code),
|
'currency_code' => strtoupper($shopProduct->currency_code),
|
||||||
'breakdown' => [
|
'breakdown' => [
|
||||||
'item_total' =>
|
'item_total' =>
|
||||||
[
|
[
|
||||||
'currency_code' => strtoupper($creditProduct->currency_code),
|
'currency_code' => strtoupper($shopProduct->currency_code),
|
||||||
'value' => $creditProduct->price,
|
'value' => $shopProduct->price,
|
||||||
],
|
],
|
||||||
'tax_total' =>
|
'tax_total' =>
|
||||||
[
|
[
|
||||||
'currency_code' => strtoupper($creditProduct->currency_code),
|
'currency_code' => strtoupper($shopProduct->currency_code),
|
||||||
'value' => $creditProduct->getTaxValue(),
|
'value' => $shopProduct->getTaxValue(),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -97,7 +97,7 @@ class PaymentController extends Controller
|
||||||
],
|
],
|
||||||
"application_context" => [
|
"application_context" => [
|
||||||
"cancel_url" => route('payment.Cancel'),
|
"cancel_url" => route('payment.Cancel'),
|
||||||
"return_url" => route('payment.PaypalSuccess', ['product' => $creditProduct->id]),
|
"return_url" => route('payment.PaypalSuccess', ['product' => $shopProduct->id]),
|
||||||
'brand_name' => config('app.name', 'Laravel'),
|
'brand_name' => config('app.name', 'Laravel'),
|
||||||
'shipping_preference' => 'NO_SHIPPING'
|
'shipping_preference' => 'NO_SHIPPING'
|
||||||
]
|
]
|
||||||
|
@ -151,8 +151,8 @@ class PaymentController extends Controller
|
||||||
*/
|
*/
|
||||||
public function PaypalSuccess(Request $laravelRequest)
|
public function PaypalSuccess(Request $laravelRequest)
|
||||||
{
|
{
|
||||||
/** @var CreditProduct $creditProduct */
|
/** @var ShopProduct $shopProduct */
|
||||||
$creditProduct = CreditProduct::findOrFail($laravelRequest->input('product'));
|
$shopProduct = ShopProduct::findOrFail($laravelRequest->input('product'));
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
@ -164,9 +164,6 @@ class PaymentController extends Controller
|
||||||
$response = $this->getPayPalClient()->execute($request);
|
$response = $this->getPayPalClient()->execute($request);
|
||||||
if ($response->statusCode == 201 || $response->statusCode == 200) {
|
if ($response->statusCode == 201 || $response->statusCode == 200) {
|
||||||
|
|
||||||
//update credits
|
|
||||||
$user->increment('credits', $creditProduct->quantity);
|
|
||||||
|
|
||||||
//update server limit
|
//update server limit
|
||||||
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||||
if ($user->server_limit < config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
if ($user->server_limit < config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
||||||
|
@ -174,6 +171,14 @@ class PaymentController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update User with bought item
|
||||||
|
if ($shopProduct->type=="Credits") {
|
||||||
|
$user->increment('credits', $shopProduct->quantity);
|
||||||
|
}elseif ($shopProduct->type=="Server slots"){
|
||||||
|
$user->increment('server_limit', $shopProduct->quantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//update role
|
//update role
|
||||||
if ($user->role == 'member') {
|
if ($user->role == 'member') {
|
||||||
$user->update(['role' => 'client']);
|
$user->update(['role' => 'client']);
|
||||||
|
@ -184,15 +189,15 @@ class PaymentController extends Controller
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'payment_id' => $response->result->id,
|
'payment_id' => $response->result->id,
|
||||||
'payment_method' => 'paypal',
|
'payment_method' => 'paypal',
|
||||||
'type' => 'Credits',
|
'type' => $shopProduct->type,
|
||||||
'status' => 'paid',
|
'status' => 'paid',
|
||||||
'amount' => $creditProduct->quantity,
|
'amount' => $shopProduct->quantity,
|
||||||
'price' => $creditProduct->price,
|
'price' => $shopProduct->price,
|
||||||
'tax_value' => $creditProduct->getTaxValue(),
|
'tax_value' => $shopProduct->getTaxValue(),
|
||||||
'tax_percent' => $creditProduct->getTaxPercent(),
|
'tax_percent' => $shopProduct->getTaxPercent(),
|
||||||
'total_price' => $creditProduct->getTotalPrice(),
|
'total_price' => $shopProduct->getTotalPrice(),
|
||||||
'currency_code' => $creditProduct->currency_code,
|
'currency_code' => $shopProduct->currency_code,
|
||||||
'credit_product_id' => $creditProduct->id,
|
'shop_item_product_id' => $shopProduct->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,7 +205,7 @@ class PaymentController extends Controller
|
||||||
|
|
||||||
//only create invoice if SETTINGS::INVOICE:ENABLED is true
|
//only create invoice if SETTINGS::INVOICE:ENABLED is true
|
||||||
if (config('SETTINGS::INVOICE:ENABLED') == 'true') {
|
if (config('SETTINGS::INVOICE:ENABLED') == 'true') {
|
||||||
$this->createInvoice($user, $payment, 'paid', $creditProduct->currency_code);
|
$this->createInvoice($user, $payment, 'paid', $shopProduct->currency_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -236,10 +241,10 @@ class PaymentController extends Controller
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function StripePay(Request $request, CreditProduct $creditProduct)
|
public function StripePay(Request $request, ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
$stripeClient = $this->getStripeClient();
|
$stripeClient = $this->getStripeClient();
|
||||||
|
|
||||||
|
@ -248,23 +253,23 @@ class PaymentController extends Controller
|
||||||
'line_items' => [
|
'line_items' => [
|
||||||
[
|
[
|
||||||
'price_data' => [
|
'price_data' => [
|
||||||
'currency' => $creditProduct->currency_code,
|
'currency' => $shopProduct->currency_code,
|
||||||
'product_data' => [
|
'product_data' => [
|
||||||
'name' => $creditProduct->display,
|
'name' => $shopProduct->display,
|
||||||
'description' => $creditProduct->description,
|
'description' => $shopProduct->description,
|
||||||
],
|
],
|
||||||
'unit_amount_decimal' => round($creditProduct->price * 100, 2),
|
'unit_amount_decimal' => round($shopProduct->price * 100, 2),
|
||||||
],
|
],
|
||||||
'quantity' => 1,
|
'quantity' => 1,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'price_data' => [
|
'price_data' => [
|
||||||
'currency' => $creditProduct->currency_code,
|
'currency' => $shopProduct->currency_code,
|
||||||
'product_data' => [
|
'product_data' => [
|
||||||
'name' => 'Product Tax',
|
'name' => 'Product Tax',
|
||||||
'description' => $creditProduct->getTaxPercent() . "%",
|
'description' => $shopProduct->getTaxPercent() . "%",
|
||||||
],
|
],
|
||||||
'unit_amount_decimal' => round($creditProduct->getTaxValue(), 2) * 100,
|
'unit_amount_decimal' => round($shopProduct->getTaxValue(), 2) * 100,
|
||||||
],
|
],
|
||||||
'quantity' => 1,
|
'quantity' => 1,
|
||||||
]
|
]
|
||||||
|
@ -272,7 +277,7 @@ class PaymentController extends Controller
|
||||||
|
|
||||||
'mode' => 'payment',
|
'mode' => 'payment',
|
||||||
"payment_method_types" => str_getcsv(config("SETTINGS::PAYMENTS:STRIPE:METHODS")),
|
"payment_method_types" => str_getcsv(config("SETTINGS::PAYMENTS:STRIPE:METHODS")),
|
||||||
'success_url' => route('payment.StripeSuccess', ['product' => $creditProduct->id]) . '&session_id={CHECKOUT_SESSION_ID}',
|
'success_url' => route('payment.StripeSuccess', ['product' => $shopProduct->id]) . '&session_id={CHECKOUT_SESSION_ID}',
|
||||||
'cancel_url' => route('payment.Cancel'),
|
'cancel_url' => route('payment.Cancel'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -286,8 +291,8 @@ class PaymentController extends Controller
|
||||||
*/
|
*/
|
||||||
public function StripeSuccess(Request $request)
|
public function StripeSuccess(Request $request)
|
||||||
{
|
{
|
||||||
/** @var CreditProduct $creditProduct */
|
/** @var ShopProduct $shopProduct */
|
||||||
$creditProduct = CreditProduct::findOrFail($request->input('product'));
|
$shopProduct = ShopProduct::findOrFail($request->input('product'));
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
@ -305,8 +310,7 @@ class PaymentController extends Controller
|
||||||
// check if payment is 100% completed and payment does not exist in db already
|
// check if payment is 100% completed and payment does not exist in db already
|
||||||
if ($paymentSession->status == "complete" && $paymentIntent->status == "succeeded" && $paymentDbEntry == 0) {
|
if ($paymentSession->status == "complete" && $paymentIntent->status == "succeeded" && $paymentDbEntry == 0) {
|
||||||
|
|
||||||
//update credits
|
|
||||||
$user->increment('credits', $creditProduct->quantity);
|
|
||||||
|
|
||||||
//update server limit
|
//update server limit
|
||||||
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||||
|
@ -315,6 +319,13 @@ class PaymentController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//update User with bought item
|
||||||
|
if ($shopProduct->type=="Credits") {
|
||||||
|
$user->increment('credits', $shopProduct->quantity);
|
||||||
|
}elseif ($shopProduct->type=="Server slots"){
|
||||||
|
$user->increment('server_limit', $shopProduct->quantity);
|
||||||
|
}
|
||||||
|
|
||||||
//update role
|
//update role
|
||||||
if ($user->role == 'member') {
|
if ($user->role == 'member') {
|
||||||
$user->update(['role' => 'client']);
|
$user->update(['role' => 'client']);
|
||||||
|
@ -325,15 +336,15 @@ class PaymentController extends Controller
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'payment_id' => $paymentSession->payment_intent,
|
'payment_id' => $paymentSession->payment_intent,
|
||||||
'payment_method' => 'stripe',
|
'payment_method' => 'stripe',
|
||||||
'type' => 'Credits',
|
'type' => $shopProduct->type,
|
||||||
'status' => 'paid',
|
'status' => 'paid',
|
||||||
'amount' => $creditProduct->quantity,
|
'amount' => $shopProduct->quantity,
|
||||||
'price' => $creditProduct->price,
|
'price' => $shopProduct->price,
|
||||||
'tax_value' => $creditProduct->getTaxValue(),
|
'tax_value' => $shopProduct->getTaxValue(),
|
||||||
'total_price' => $creditProduct->getTotalPrice(),
|
'total_price' => $shopProduct->getTotalPrice(),
|
||||||
'tax_percent' => $creditProduct->getTaxPercent(),
|
'tax_percent' => $shopProduct->getTaxPercent(),
|
||||||
'currency_code' => $creditProduct->currency_code,
|
'currency_code' => $shopProduct->currency_code,
|
||||||
'credit_product_id' => $creditProduct->id,
|
'shop_item_product_id' => $shopProduct->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//payment notification
|
//payment notification
|
||||||
|
@ -343,7 +354,7 @@ class PaymentController extends Controller
|
||||||
|
|
||||||
//only create invoice if SETTINGS::INVOICE:ENABLED is true
|
//only create invoice if SETTINGS::INVOICE:ENABLED is true
|
||||||
if (config('SETTINGS::INVOICE:ENABLED') == 'true') {
|
if (config('SETTINGS::INVOICE:ENABLED') == 'true') {
|
||||||
$this->createInvoice($user, $payment, 'paid', $creditProduct->currency_code);
|
$this->createInvoice($user, $payment, 'paid', $shopProduct->currency_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
//redirect back to home
|
//redirect back to home
|
||||||
|
@ -356,20 +367,20 @@ class PaymentController extends Controller
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'payment_id' => $paymentSession->payment_intent,
|
'payment_id' => $paymentSession->payment_intent,
|
||||||
'payment_method' => 'stripe',
|
'payment_method' => 'stripe',
|
||||||
'type' => 'Credits',
|
'type' => $shopProduct->type,
|
||||||
'status' => 'processing',
|
'status' => 'processing',
|
||||||
'amount' => $creditProduct->quantity,
|
'amount' => $shopProduct->quantity,
|
||||||
'price' => $creditProduct->price,
|
'price' => $shopProduct->price,
|
||||||
'tax_value' => $creditProduct->getTaxValue(),
|
'tax_value' => $shopProduct->getTaxValue(),
|
||||||
'total_price' => $creditProduct->getTotalPrice(),
|
'total_price' => $shopProduct->getTotalPrice(),
|
||||||
'tax_percent' => $creditProduct->getTaxPercent(),
|
'tax_percent' => $shopProduct->getTaxPercent(),
|
||||||
'currency_code' => $creditProduct->currency_code,
|
'currency_code' => $shopProduct->currency_code,
|
||||||
'credit_product_id' => $creditProduct->id,
|
'shop_item_product_id' => $shopProduct->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//only create invoice if SETTINGS::INVOICE:ENABLED is true
|
//only create invoice if SETTINGS::INVOICE:ENABLED is true
|
||||||
if (config('SETTINGS::INVOICE:ENABLED') == 'true') {
|
if (config('SETTINGS::INVOICE:ENABLED') == 'true') {
|
||||||
$this->createInvoice($user, $payment, 'paid', $creditProduct->currency_code);
|
$this->createInvoice($user, $payment, 'paid', $shopProduct->currency_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
//redirect back to home
|
//redirect back to home
|
||||||
|
@ -405,8 +416,7 @@ class PaymentController extends Controller
|
||||||
$user = User::where('id', $payment->user_id)->first();
|
$user = User::where('id', $payment->user_id)->first();
|
||||||
|
|
||||||
if ($paymentIntent->status == 'succeeded' && $payment->status == 'processing') {
|
if ($paymentIntent->status == 'succeeded' && $payment->status == 'processing') {
|
||||||
// Increment User Credits
|
|
||||||
$user->increment('credits', $payment->amount);
|
|
||||||
|
|
||||||
//update server limit
|
//update server limit
|
||||||
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||||
|
@ -414,6 +424,12 @@ class PaymentController extends Controller
|
||||||
$user->update(['server_limit' => config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
$user->update(['server_limit' => config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//update User with bought item
|
||||||
|
if ($shopProduct->type=="Credits") {
|
||||||
|
$user->increment('credits', $shopProduct->quantity);
|
||||||
|
}elseif ($shopProduct->type=="Server slots"){
|
||||||
|
$user->increment('server_limit', $shopProduct->quantity);
|
||||||
|
}
|
||||||
|
|
||||||
//update role
|
//update role
|
||||||
if ($user->role == 'member') {
|
if ($user->role == 'member') {
|
||||||
|
@ -505,7 +521,7 @@ class PaymentController extends Controller
|
||||||
|
|
||||||
protected function createInvoice($user, $payment, $paymentStatus, $currencyCode)
|
protected function createInvoice($user, $payment, $paymentStatus, $currencyCode)
|
||||||
{
|
{
|
||||||
$creditProduct = CreditProduct::where('id', $payment->credit_product_id)->first();
|
$shopProduct = ShopProduct::where('id', $payment->shop_item_product_id)->first();
|
||||||
//create invoice
|
//create invoice
|
||||||
$lastInvoiceID = \App\Models\Invoice::where("invoice_name", "like", "%" . now()->format('mY') . "%")->count("id");
|
$lastInvoiceID = \App\Models\Invoice::where("invoice_name", "like", "%" . now()->format('mY') . "%")->count("id");
|
||||||
$newInvoiceID = $lastInvoiceID + 1;
|
$newInvoiceID = $lastInvoiceID + 1;
|
||||||
|
@ -531,8 +547,8 @@ class PaymentController extends Controller
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
$item = (new InvoiceItem())
|
$item = (new InvoiceItem())
|
||||||
->title($creditProduct->description)
|
->title($shopProduct->description)
|
||||||
->pricePerUnit($creditProduct->price);
|
->pricePerUnit($shopProduct->price);
|
||||||
|
|
||||||
$notes = [
|
$notes = [
|
||||||
__("Payment method") . ": " . $payment->payment_method,
|
__("Payment method") . ": " . $payment->payment_method,
|
||||||
|
@ -546,7 +562,7 @@ class PaymentController extends Controller
|
||||||
->buyer($customer)
|
->buyer($customer)
|
||||||
->seller($seller)
|
->seller($seller)
|
||||||
->discountByPercent(0)
|
->discountByPercent(0)
|
||||||
->taxRate(floatval($creditProduct->getTaxPercent()))
|
->taxRate(floatval($shopProduct->getTaxPercent()))
|
||||||
->shipping(0)
|
->shipping(0)
|
||||||
->addItem($item)
|
->addItem($item)
|
||||||
->status(__($paymentStatus))
|
->status(__($paymentStatus))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Models\CreditProduct;
|
use App\Models\ShopProduct;
|
||||||
use App\Models\Settings;
|
use App\Models\Settings;
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
|
@ -13,7 +13,7 @@ use Illuminate\Http\Response;
|
||||||
use Illuminate\Routing\Controller;
|
use Illuminate\Routing\Controller;
|
||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
class CreditProductController extends Controller
|
class ShopProductController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
|
@ -66,7 +66,7 @@ class CreditProductController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$disabled = !is_null($request->input('disabled'));
|
$disabled = !is_null($request->input('disabled'));
|
||||||
CreditProduct::create(array_merge($request->all(), ['disabled' => $disabled]));
|
ShopProduct::create(array_merge($request->all(), ['disabled' => $disabled]));
|
||||||
|
|
||||||
return redirect()->route('admin.store.index')->with('success', __('Store item has been created!'));
|
return redirect()->route('admin.store.index')->with('success', __('Store item has been created!'));
|
||||||
}
|
}
|
||||||
|
@ -74,10 +74,10 @@ class CreditProductController extends Controller
|
||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function show(CreditProduct $creditProduct)
|
public function show(ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
@ -85,14 +85,14 @@ class CreditProductController extends Controller
|
||||||
/**
|
/**
|
||||||
* Show the form for editing the specified resource.
|
* Show the form for editing the specified resource.
|
||||||
*
|
*
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return Application|Factory|View|Response
|
* @return Application|Factory|View|Response
|
||||||
*/
|
*/
|
||||||
public function edit(CreditProduct $creditProduct)
|
public function edit(ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
return view('admin.store.edit', [
|
return view('admin.store.edit', [
|
||||||
'currencyCodes' => config('currency_codes'),
|
'currencyCodes' => config('currency_codes'),
|
||||||
'creditProduct' => $creditProduct
|
'shopProduct' => $shopProduct
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,10 +100,10 @@ class CreditProductController extends Controller
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, CreditProduct $creditProduct)
|
public function update(Request $request, ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
"disabled" => "nullable",
|
"disabled" => "nullable",
|
||||||
|
@ -116,19 +116,19 @@ class CreditProductController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$disabled = !is_null($request->input('disabled'));
|
$disabled = !is_null($request->input('disabled'));
|
||||||
$creditProduct->update(array_merge($request->all(), ['disabled' => $disabled]));
|
$shopProduct->update(array_merge($request->all(), ['disabled' => $disabled]));
|
||||||
|
|
||||||
return redirect()->route('admin.store.index')->with('success', __('Store item has been updated!'));
|
return redirect()->route('admin.store.index')->with('success', __('Store item has been updated!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function disable(Request $request, CreditProduct $creditProduct)
|
public function disable(Request $request, ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
$creditProduct->update(['disabled' => !$creditProduct->disabled]);
|
$shopProduct->update(['disabled' => !$shopProduct->disabled]);
|
||||||
|
|
||||||
return redirect()->route('admin.store.index')->with('success', __('Product has been updated!'));
|
return redirect()->route('admin.store.index')->with('success', __('Product has been updated!'));
|
||||||
}
|
}
|
||||||
|
@ -136,50 +136,50 @@ class CreditProductController extends Controller
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param CreditProduct $creditProduct
|
* @param ShopProduct $shopProduct
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function destroy(CreditProduct $creditProduct)
|
public function destroy(ShopProduct $shopProduct)
|
||||||
{
|
{
|
||||||
$creditProduct->delete();
|
$shopProduct->delete();
|
||||||
return redirect()->back()->with('success', __('Store item has been removed!'));
|
return redirect()->back()->with('success', __('Store item has been removed!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function dataTable()
|
public function dataTable()
|
||||||
{
|
{
|
||||||
$query = CreditProduct::query();
|
$query = ShopProduct::query();
|
||||||
|
|
||||||
return datatables($query)
|
return datatables($query)
|
||||||
->addColumn('actions', function (CreditProduct $creditProduct) {
|
->addColumn('actions', function (ShopProduct $shopProduct) {
|
||||||
return '
|
return '
|
||||||
<a data-content="' . __("Edit") . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.store.edit', $creditProduct->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
<a data-content="' . __("Edit") . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.store.edit', $shopProduct->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||||
|
|
||||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.destroy', $creditProduct->id) . '">
|
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.destroy', $shopProduct->id) . '">
|
||||||
' . csrf_field() . '
|
' . csrf_field() . '
|
||||||
' . method_field("DELETE") . '
|
' . method_field("DELETE") . '
|
||||||
<button data-content="' . __("Delete") . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
<button data-content="' . __("Delete") . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
|
||||||
</form>
|
</form>
|
||||||
';
|
';
|
||||||
})
|
})
|
||||||
->addColumn('disabled', function (CreditProduct $creditProduct) {
|
->addColumn('disabled', function (ShopProduct $shopProduct) {
|
||||||
$checked = $creditProduct->disabled == false ? "checked" : "";
|
$checked = $shopProduct->disabled == false ? "checked" : "";
|
||||||
return '
|
return '
|
||||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.disable', $creditProduct->id) . '">
|
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.disable', $shopProduct->id) . '">
|
||||||
' . csrf_field() . '
|
' . csrf_field() . '
|
||||||
' . method_field("PATCH") . '
|
' . method_field("PATCH") . '
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input ' . $checked . ' name="disabled" onchange="this.form.submit()" type="checkbox" class="custom-control-input" id="switch' . $creditProduct->id . '">
|
<input ' . $checked . ' name="disabled" onchange="this.form.submit()" type="checkbox" class="custom-control-input" id="switch' . $shopProduct->id . '">
|
||||||
<label class="custom-control-label" for="switch' . $creditProduct->id . '"></label>
|
<label class="custom-control-label" for="switch' . $shopProduct->id . '"></label>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
';
|
';
|
||||||
})
|
})
|
||||||
->editColumn('created_at', function (CreditProduct $creditProduct) {
|
->editColumn('created_at', function (ShopProduct $shopProduct) {
|
||||||
return $creditProduct->created_at ? $creditProduct->created_at->diffForHumans() : '';
|
return $shopProduct->created_at ? $shopProduct->created_at->diffForHumans() : '';
|
||||||
})
|
})
|
||||||
->editColumn('price', function (CreditProduct $creditProduct) {
|
->editColumn('price', function (ShopProduct $shopProduct) {
|
||||||
return $creditProduct->formatToCurrency($creditProduct->price);
|
return $shopProduct->formatToCurrency($shopProduct->price);
|
||||||
})
|
})
|
||||||
->rawColumns(['actions', 'disabled'])
|
->rawColumns(['actions', 'disabled'])
|
||||||
->make();
|
->make();
|
|
@ -304,8 +304,8 @@ class UserController extends Controller
|
||||||
->editColumn('name', function (User $user) {
|
->editColumn('name', function (User $user) {
|
||||||
return '<a class="text-info" target="_blank" href="' . config("SETTINGS::SYSTEM:PTERODACTYL:URL") . '/admin/users/view/' . $user->pterodactyl_id . '">' . strip_tags($user->name) . '</a>';
|
return '<a class="text-info" target="_blank" href="' . config("SETTINGS::SYSTEM:PTERODACTYL:URL") . '/admin/users/view/' . $user->pterodactyl_id . '">' . strip_tags($user->name) . '</a>';
|
||||||
})
|
})
|
||||||
->orderColumn('last_seen', function ($query, $order) {
|
->orderColumn('last_seen', function ($query) {
|
||||||
$query->orderBy('last_seen', $order);
|
$query->orderBy('last_seen', "desc");
|
||||||
})
|
})
|
||||||
->rawColumns(['avatar', 'name', 'credits', 'role', 'usage', 'actions', 'last_seen'])
|
->rawColumns(['avatar', 'name', 'credits', 'role', 'usage', 'actions', 'last_seen'])
|
||||||
->make(true);
|
->make(true);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\CreditProduct;
|
use App\Models\ShopProduct;
|
||||||
use App\Models\Settings;
|
use App\Models\Settings;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class StoreController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('store.index')->with([
|
return view('store.index')->with([
|
||||||
'products' => CreditProduct::where('disabled', '=', false)->orderBy('price', 'asc')->get(),
|
'products' => ShopProduct::where('disabled', '=', false)->orderBy('type', 'asc')->orderBy('price', 'asc')->get(),
|
||||||
'isPaymentSetup' => $isPaymentSetup,
|
'isPaymentSetup' => $isPaymentSetup,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Payment extends Model
|
||||||
'total_price',
|
'total_price',
|
||||||
'tax_percent',
|
'tax_percent',
|
||||||
'currency_code',
|
'currency_code',
|
||||||
'credit_product_id',
|
'shop_item_product_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function boot()
|
public static function boot()
|
||||||
|
|
|
@ -8,7 +8,7 @@ use NumberFormatter;
|
||||||
use Spatie\Activitylog\Traits\LogsActivity;
|
use Spatie\Activitylog\Traits\LogsActivity;
|
||||||
use App\Models\Configuration;
|
use App\Models\Configuration;
|
||||||
|
|
||||||
class CreditProduct extends Model
|
class ShopProduct extends Model
|
||||||
{
|
{
|
||||||
use LogsActivity;
|
use LogsActivity;
|
||||||
/**
|
/**
|
||||||
|
@ -33,10 +33,10 @@ class CreditProduct extends Model
|
||||||
{
|
{
|
||||||
parent::boot();
|
parent::boot();
|
||||||
|
|
||||||
static::creating(function (CreditProduct $creditProduct) {
|
static::creating(function (ShopProduct $shopProduct) {
|
||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
$creditProduct->{$creditProduct->getKeyName()} = $client->generateId($size = 21);
|
$shopProduct->{$shopProduct->getKeyName()} = $client->generateId($size = 21);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,17 +42,17 @@ class WelcomeMessage extends Notification implements ShouldQueue
|
||||||
|
|
||||||
$AdditionalLine = "";
|
$AdditionalLine = "";
|
||||||
if (config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL') != 0) {
|
if (config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL') != 0) {
|
||||||
$AdditionalLine .= "Verifying your e-mail address will grant you " . config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL') . " additional " . config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME') . ". <br />";
|
$AdditionalLine .= __("Verifying your e-mail address will grant you ") . config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL'). " " . __("additional") . " " . config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME') . ". <br />";
|
||||||
}
|
}
|
||||||
if (config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') != 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') != 0) {
|
||||||
$AdditionalLine .= "Verifying your e-mail will also increase your Server Limit by " . config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') . ". <br />";
|
$AdditionalLine .= __("Verifying your e-mail will also increase your Server Limit by ") . config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') . ". <br />";
|
||||||
}
|
}
|
||||||
$AdditionalLine .= "<br />";
|
$AdditionalLine .= "<br />";
|
||||||
if (config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD') != 0) {
|
if (config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD') != 0) {
|
||||||
$AdditionalLine .= "You can also verify your discord account to get another " . config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD') . " " . config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME') . ". <br />";
|
$AdditionalLine .= __("You can also verify your discord account to get another ") . config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD') . " " . config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME') . ". <br />";
|
||||||
}
|
}
|
||||||
if (config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') != 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') != 0) {
|
||||||
$AdditionalLine .= "Verifying your Discord account will also increase your Server Limit by " . config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') . ". <br />";
|
$AdditionalLine .= __("Verifying your Discord account will also increase your Server Limit by ") . config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') . ". <br />";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $AdditionalLine;
|
return $AdditionalLine;
|
||||||
|
@ -65,19 +65,20 @@ class WelcomeMessage extends Notification implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public function toArray($notifiable)
|
public function toArray($notifiable)
|
||||||
{
|
{
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'title' => __("Getting started!"),
|
'title' => __("Getting started!"),
|
||||||
'content' => "
|
'content' => "
|
||||||
<p>Hello <strong>{$this->user->name}</strong>, Welcome to our dashboard!</p>
|
<p> ".__("Hello")." <strong>{$this->user->name}</strong>, ".__("Welcome to our dashboard")."!</p>
|
||||||
<h5>Verification</h5>
|
<h5>".__("Verification")."</h5>
|
||||||
<p>You can verify your e-mail address and link/verify your Discord account.</p>
|
<p>".__("You can verify your e-mail address and link/verify your Discord account.")."</p>
|
||||||
<p>
|
<p>
|
||||||
" . $this->AdditionalLines() . "
|
" . $this->AdditionalLines() . "
|
||||||
</p>
|
</p>
|
||||||
<h5>Information</h5>
|
<h5>".__("Information")."</h5>
|
||||||
<p>This dashboard can be used to create and delete servers.<br /> These servers can be used and managed on our pterodactyl panel.<br /> If you have any questions, please join our Discord server and #create-a-ticket.</p>
|
<p>".__("This dashboard can be used to create and delete servers").".<br /> ".__("These servers can be used and managed on our pterodactyl panel").".<br /> ".__("If you have any questions, please join our Discord server and #create-a-ticket").".</p>
|
||||||
<p>We hope you can enjoy this hosting experience and if you have any suggestions please let us know!</p>
|
<p>".__("We hope you can enjoy this hosting experience and if you have any suggestions please let us know")."!</p>
|
||||||
<p>Regards,<br />" . config('app.name', 'Laravel') . "</p>
|
<p>".__("Regards").",<br />" . config('app.name', 'Laravel') . "</p>
|
||||||
",
|
",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ use App\Models\Settings;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'version' => '0.7.4',
|
'version' => '0.7.5',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class RenameCreditsProduct extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::rename('credit_products', 'shop_products');
|
||||||
|
Schema::table('payments', function(Blueprint $table) {
|
||||||
|
$table->renameColumn('credit_product_id', 'shop_item_product_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::rename('shop_products', 'credit_products');
|
||||||
|
|
||||||
|
Schema::table('payments', function(Blueprint $table) {
|
||||||
|
$table->renameColumn('shop_item_product_id', 'credit_product_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use Database\Seeders\Seeds\ProductSeeder;
|
use Database\Seeders\Seeds\ProductSeeder;
|
||||||
use Database\Seeders\Seeds\CreditProductSeeder;
|
use Database\Seeders\Seeds\ShopProductSeeder;
|
||||||
use Database\Seeders\Seeds\ApplicationApiSeeder;
|
use Database\Seeders\Seeds\ApplicationApiSeeder;
|
||||||
use Database\Seeders\Seeds\UsefulLinksSeeder;
|
use Database\Seeders\Seeds\UsefulLinksSeeder;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
@ -19,7 +19,7 @@ class ExampleItemsSeeder extends Seeder
|
||||||
{
|
{
|
||||||
$this->call([
|
$this->call([
|
||||||
ProductSeeder::class,
|
ProductSeeder::class,
|
||||||
CreditProductSeeder::class,
|
ShopProductSeeder::class,
|
||||||
ApplicationApiSeeder::class,
|
ApplicationApiSeeder::class,
|
||||||
UsefulLinksSeeder::class
|
UsefulLinksSeeder::class
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
namespace Database\Seeders\Seeds;
|
namespace Database\Seeders\Seeds;
|
||||||
|
|
||||||
use App\Models\CreditProduct;
|
use App\Models\ShopProduct;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class CreditProductSeeder extends Seeder
|
class ShopProductSeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the database seeds.
|
* Run the database seeds.
|
||||||
|
@ -14,7 +14,7 @@ class CreditProductSeeder extends Seeder
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
CreditProduct::create([
|
ShopProduct::create([
|
||||||
'type' => 'Credits',
|
'type' => 'Credits',
|
||||||
'display' => '350',
|
'display' => '350',
|
||||||
'description' => 'Adds 350 credits to your account',
|
'description' => 'Adds 350 credits to your account',
|
||||||
|
@ -24,7 +24,7 @@ class CreditProductSeeder extends Seeder
|
||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
CreditProduct::create([
|
ShopProduct::create([
|
||||||
'type' => 'Credits',
|
'type' => 'Credits',
|
||||||
'display' => '875 + 125',
|
'display' => '875 + 125',
|
||||||
'description' => 'Adds 1000 credits to your account',
|
'description' => 'Adds 1000 credits to your account',
|
||||||
|
@ -34,7 +34,7 @@ class CreditProductSeeder extends Seeder
|
||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
CreditProduct::create([
|
ShopProduct::create([
|
||||||
'type' => 'Credits',
|
'type' => 'Credits',
|
||||||
'display' => '1750 + 250',
|
'display' => '1750 + 250',
|
||||||
'description' => 'Adds 2000 credits to your account',
|
'description' => 'Adds 2000 credits to your account',
|
||||||
|
@ -44,7 +44,7 @@ class CreditProductSeeder extends Seeder
|
||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
CreditProduct::create([
|
ShopProduct::create([
|
||||||
'type' => 'Credits',
|
'type' => 'Credits',
|
||||||
'display' => '3500 + 500',
|
'display' => '3500 + 500',
|
||||||
'description' => 'Adds 4000 credits to your account',
|
'description' => 'Adds 4000 credits to your account',
|
||||||
|
@ -53,5 +53,15 @@ class CreditProductSeeder extends Seeder
|
||||||
'price' => 20.00,
|
'price' => 20.00,
|
||||||
'disabled' => false,
|
'disabled' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
ShopProduct::create([
|
||||||
|
'type' => 'Server slots',
|
||||||
|
'display' => '+2 Server slots',
|
||||||
|
'description' => 'You will be able to create 2 more servers',
|
||||||
|
'quantity' => '2',
|
||||||
|
'currency_code' => 'EUR',
|
||||||
|
'price' => 5.00,
|
||||||
|
'disabled' => false,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -59,7 +59,7 @@ if (isset($_POST['checkGeneral'])) {
|
||||||
|
|
||||||
|
|
||||||
setEnvironmentValue("APP_NAME", $appname);
|
setEnvironmentValue("APP_NAME", $appname);
|
||||||
setEnvironmentValue("APP_URL", $url);
|
setEnvironmentValue("APP_URL", $appurl);
|
||||||
|
|
||||||
header("LOCATION: index.php?step=4");
|
header("LOCATION: index.php?step=4");
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
stateSave: true,
|
stateSave: true,
|
||||||
ajax: "{{ route('admin.payments.datatable') }}",
|
ajax: "{{ route('admin.payments.datatable') }}",
|
||||||
|
order: [[ 9, "asc" ]],
|
||||||
columns: [
|
columns: [
|
||||||
{data: 'id',name: 'payments.id'},
|
{data: 'id',name: 'payments.id'},
|
||||||
{data: 'type'},
|
{data: 'type'},
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
<select required name="type" id="type"
|
<select required name="type" id="type"
|
||||||
class="custom-select @error('name') is-invalid @enderror">
|
class="custom-select @error('name') is-invalid @enderror">
|
||||||
<option selected value="Credits">{{CREDITS_DISPLAY_NAME}}</option>
|
<option selected value="Credits">{{CREDITS_DISPLAY_NAME}}</option>
|
||||||
|
<option value="Server slots">{{__("Server Slots")}}</option>
|
||||||
</select>
|
</select>
|
||||||
@error('name')
|
@error('name')
|
||||||
<div class="text-danger">
|
<div class="text-danger">
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
|
<li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
|
||||||
<li class="breadcrumb-item"><a href="{{ route('admin.store.index') }}">{{ __('Store') }}</a></li>
|
<li class="breadcrumb-item"><a href="{{ route('admin.store.index') }}">{{ __('Store') }}</a></li>
|
||||||
<li class="breadcrumb-item"><a class="text-muted"
|
<li class="breadcrumb-item"><a class="text-muted"
|
||||||
href="{{ route('admin.store.edit', $creditProduct->id) }}">{{ __('Edit') }}</a>
|
href="{{ route('admin.store.edit', $shopProduct->id) }}">{{ __('Edit') }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,12 +30,12 @@
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form action="{{ route('admin.store.update', $creditProduct->id) }}" method="POST">
|
<form action="{{ route('admin.store.update', $shopProduct->id) }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PATCH')
|
@method('PATCH')
|
||||||
<div class="d-flex flex-row-reverse">
|
<div class="d-flex flex-row-reverse">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input type="checkbox" @if ($creditProduct->disabled) checked @endif name="disabled"
|
<input type="checkbox" @if ($shopProduct->disabled) checked @endif name="disabled"
|
||||||
class="custom-control-input custom-control-input-danger" id="switch1">
|
class="custom-control-input custom-control-input-danger" id="switch1">
|
||||||
<label class="custom-control-label" for="switch1">{{ __('Disabled') }} <i
|
<label class="custom-control-label" for="switch1">{{ __('Disabled') }} <i
|
||||||
data-toggle="popover" data-trigger="hover"
|
data-toggle="popover" data-trigger="hover"
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
<select required name="currency_code" id="currency_code"
|
<select required name="currency_code" id="currency_code"
|
||||||
class="custom-select @error('name') is-invalid @enderror">
|
class="custom-select @error('name') is-invalid @enderror">
|
||||||
@foreach ($currencyCodes as $code)
|
@foreach ($currencyCodes as $code)
|
||||||
<option @if ($creditProduct->currency_code == $code) selected @endif value="{{ $code }}">
|
<option @if ($shopProduct->currency_code == $code) selected @endif value="{{ $code }}">
|
||||||
{{ $code }}</option>
|
{{ $code }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="price">Price</label>
|
<label for="price">Price</label>
|
||||||
<input value="{{ $creditProduct->price }}" id="price" name="price" type="number"
|
<input value="{{ $shopProduct->price }}" id="price" name="price" type="number"
|
||||||
placeholder="10.00" step="any"
|
placeholder="10.00" step="any"
|
||||||
class="form-control @error('price') is-invalid @enderror" required="required">
|
class="form-control @error('price') is-invalid @enderror" required="required">
|
||||||
@error('price')
|
@error('price')
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="quantity">Quantity</label>
|
<label for="quantity">Quantity</label>
|
||||||
<input value="{{ $creditProduct->quantity }}" id="quantity" name="quantity"
|
<input value="{{ $shopProduct->quantity }}" id="quantity" name="quantity"
|
||||||
type="number" placeholder="1000"
|
type="number" placeholder="1000"
|
||||||
class="form-control @error('quantity') is-invalid @enderror" required="required">
|
class="form-control @error('quantity') is-invalid @enderror" required="required">
|
||||||
@error('quantity')
|
@error('quantity')
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="display">Display</label>
|
<label for="display">Display</label>
|
||||||
<input value="{{ $creditProduct->display }}" id="display" name="display" type="text"
|
<input value="{{ $shopProduct->display }}" id="display" name="display" type="text"
|
||||||
placeholder="750 + 250" class="form-control @error('display') is-invalid @enderror"
|
placeholder="750 + 250" class="form-control @error('display') is-invalid @enderror"
|
||||||
required="required">
|
required="required">
|
||||||
@error('display')
|
@error('display')
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="description">Description</label>
|
<label for="description">Description</label>
|
||||||
<input value="{{ $creditProduct->description }}" id="description" name="description"
|
<input value="{{ $shopProduct->description }}" id="description" name="description"
|
||||||
type="text" placeholder="{{ __('Adds 1000 credits to your account') }}"
|
type="text" placeholder="{{ __('Adds 1000 credits to your account') }}"
|
||||||
class="form-control @error('description') is-invalid @enderror" required="required">
|
class="form-control @error('description') is-invalid @enderror" required="required">
|
||||||
@error('description')
|
@error('description')
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
stateSave: true,
|
stateSave: true,
|
||||||
ajax: "{{route('admin.users.datatable')}}",
|
ajax: "{{route('admin.users.datatable')}}",
|
||||||
order: [[ 10, "desc" ]],
|
order: [[ 10, "asc" ]],
|
||||||
columns: [
|
columns: [
|
||||||
{data: 'discordId', visible: false, name: 'discordUser.id'},
|
{data: 'discordId', visible: false, name: 'discordUser.id'},
|
||||||
{data: 'pterodactyl_id', visible: false},
|
{data: 'pterodactyl_id', visible: false},
|
||||||
|
|
|
@ -49,10 +49,12 @@
|
||||||
<a href="{{ route('home') }}" class="nav-link"><i
|
<a href="{{ route('home') }}" class="nav-link"><i
|
||||||
class="fas fa-home mr-2"></i>{{ __('Home') }}</a>
|
class="fas fa-home mr-2"></i>{{ __('Home') }}</a>
|
||||||
</li>
|
</li>
|
||||||
|
@if(config('SETTINGS::DISCORD:INVITE_URL'))
|
||||||
<li class="nav-item d-none d-sm-inline-block">
|
<li class="nav-item d-none d-sm-inline-block">
|
||||||
<a href="{{ config('SETTINGS::DISCORD:INVITE_URL') }}" class="nav-link" target="__blank"><i
|
<a href="{{ config('SETTINGS::DISCORD:INVITE_URL') }}" class="nav-link" target="__blank"><i
|
||||||
class="fab fa-discord mr-2"></i>{{ __('Discord') }}</a>
|
class="fab fa-discord mr-2"></i>{{ __('Discord') }}</a>
|
||||||
</li>
|
</li>
|
||||||
|
@endif
|
||||||
<!-- Language Selection -->
|
<!-- Language Selection -->
|
||||||
@if (config('SETTINGS::LOCALE:CLIENTS_CAN_CHANGE') == 'true')
|
@if (config('SETTINGS::LOCALE:CLIENTS_CAN_CHANGE') == 'true')
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
@extends('layouts.main')
|
@extends('layouts.main')
|
||||||
<?php use App\Models\CreditProduct; ?>
|
<?php use App\Models\ShopProduct; ?>
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<!-- CONTENT HEADER -->
|
<!-- CONTENT HEADER -->
|
||||||
|
@ -49,14 +49,21 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php /** @var $product CreditProduct */
|
<?php /** @var $product ShopProduct */
|
||||||
?>
|
?>
|
||||||
@foreach ($products as $product)
|
@foreach ($products as $product)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $product->formatToCurrency($product->price) }}</td>
|
<td>{{ $product->formatToCurrency($product->price) }}</td>
|
||||||
<td>{{ strtolower($product->type) == 'credits' ? CREDITS_DISPLAY_NAME : $product->type }}
|
<td>{{ strtolower($product->type) == 'credits' ? CREDITS_DISPLAY_NAME : $product->type }}
|
||||||
</td>
|
</td>
|
||||||
<td><i class="fa fa-coins mr-2"></i>{{ $product->display }}</td>
|
<td>
|
||||||
|
@if(strtolower($product->type) == 'credits')
|
||||||
|
<i class="fa fa-coins mr-2"></i>
|
||||||
|
@elseif (strtolower($product->type) == 'server slots')
|
||||||
|
<i class="fa fa-server mr-2"></i>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
{{ $product->display }}</td>
|
||||||
<td><a href="{{ route('checkout', $product->id) }}"
|
<td><a href="{{ route('checkout', $product->id) }}"
|
||||||
class="btn btn-info">{{ __('Purchase') }}</a>
|
class="btn btn-info">{{ __('Purchase') }}</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -87,7 +94,6 @@
|
||||||
const urlParams = new URLSearchParams(queryString);
|
const urlParams = new URLSearchParams(queryString);
|
||||||
return urlParams.get(param);
|
return urlParams.get(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
const voucherCode = getUrlParameter('voucher');
|
const voucherCode = getUrlParameter('voucher');
|
||||||
//if voucherCode not empty, open the modal and fill the input
|
//if voucherCode not empty, open the modal and fill the input
|
||||||
if (voucherCode) {
|
if (voucherCode) {
|
||||||
|
@ -95,7 +101,6 @@
|
||||||
$('#redeemVoucherModal').modal('show');
|
$('#redeemVoucherModal').modal('show');
|
||||||
$('#redeemVoucherCode').val(voucherCode);
|
$('#redeemVoucherCode').val(voucherCode);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use App\Http\Controllers\Admin\ApplicationApiController;
|
||||||
use App\Http\Controllers\Admin\InvoiceController;
|
use App\Http\Controllers\Admin\InvoiceController;
|
||||||
use App\Http\Controllers\Admin\OverViewController;
|
use App\Http\Controllers\Admin\OverViewController;
|
||||||
use App\Http\Controllers\Admin\PaymentController;
|
use App\Http\Controllers\Admin\PaymentController;
|
||||||
use App\Http\Controllers\Admin\CreditProductController;
|
use App\Http\Controllers\Admin\ShopProductController;
|
||||||
use App\Http\Controllers\Admin\ProductController;
|
use App\Http\Controllers\Admin\ProductController;
|
||||||
use App\Http\Controllers\Admin\ServerController as AdminServerController;
|
use App\Http\Controllers\Admin\ServerController as AdminServerController;
|
||||||
use App\Http\Controllers\Admin\SettingsController;
|
use App\Http\Controllers\Admin\SettingsController;
|
||||||
|
@ -70,10 +70,10 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
||||||
Route::get('/products/products/{egg?}/{node?}', [FrontProductController::class, 'getProductsBasedOnNode'])->name('products.products.node');
|
Route::get('/products/products/{egg?}/{node?}', [FrontProductController::class, 'getProductsBasedOnNode'])->name('products.products.node');
|
||||||
|
|
||||||
#payments
|
#payments
|
||||||
Route::get('checkout/{creditProduct}', [PaymentController::class, 'checkOut'])->name('checkout');
|
Route::get('checkout/{shopProduct}', [PaymentController::class, 'checkOut'])->name('checkout');
|
||||||
Route::get('payment/PaypalPay/{creditProduct}', [PaymentController::class, 'PaypalPay'])->name('payment.PaypalPay');
|
Route::get('payment/PaypalPay/{shopProduct}', [PaymentController::class, 'PaypalPay'])->name('payment.PaypalPay');
|
||||||
Route::get('payment/PaypalSuccess', [PaymentController::class, 'PaypalSuccess'])->name('payment.PaypalSuccess');
|
Route::get('payment/PaypalSuccess', [PaymentController::class, 'PaypalSuccess'])->name('payment.PaypalSuccess');
|
||||||
Route::get('payment/StripePay/{creditProduct}', [PaymentController::class, 'StripePay'])->name('payment.StripePay');
|
Route::get('payment/StripePay/{shopProduct}', [PaymentController::class, 'StripePay'])->name('payment.StripePay');
|
||||||
Route::get('payment/StripeSuccess', [PaymentController::class, 'StripeSuccess'])->name('payment.StripeSuccess');
|
Route::get('payment/StripeSuccess', [PaymentController::class, 'StripeSuccess'])->name('payment.StripeSuccess');
|
||||||
Route::get('payment/Cancel', [PaymentController::class, 'Cancel'])->name('payment.Cancel');
|
Route::get('payment/Cancel', [PaymentController::class, 'Cancel'])->name('payment.Cancel');
|
||||||
|
|
||||||
|
@ -120,10 +120,10 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
||||||
Route::resource('products', ProductController::class);
|
Route::resource('products', ProductController::class);
|
||||||
|
|
||||||
#store
|
#store
|
||||||
Route::get('store/datatable', [CreditProductController::class, 'datatable'])->name('store.datatable');
|
Route::get('store/datatable', [ShopProductController::class, 'datatable'])->name('store.datatable');
|
||||||
Route::patch('store/disable/{creditProduct}', [CreditProductController::class, 'disable'])->name('store.disable');
|
Route::patch('store/disable/{shopProduct}', [ShopProductController::class, 'disable'])->name('store.disable');
|
||||||
Route::resource('store', CreditProductController::class)->parameters([
|
Route::resource('store', ShopProductController::class)->parameters([
|
||||||
'store' => 'creditProduct',
|
'store' => 'shopProduct',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#payments
|
#payments
|
||||||
|
|
Loading…
Reference in a new issue