Rename PaypalProduct -> CreditProduct
This commit is contained in:
parent
bd6cec92ea
commit
e3b8ff5045
13 changed files with 1609 additions and 951 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\PaypalProduct;
|
||||
use App\Models\CreditProduct;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
@ -12,7 +12,7 @@ use Illuminate\Http\Response;
|
|||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class PaypalProductController extends Controller
|
||||
class CreditProductController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
|
@ -60,7 +60,7 @@ class PaypalProductController extends Controller
|
|||
]);
|
||||
|
||||
$disabled = !is_null($request->input('disabled'));
|
||||
PaypalProduct::create(array_merge($request->all(), ['disabled' => $disabled]));
|
||||
CreditProduct::create(array_merge($request->all(), ['disabled' => $disabled]));
|
||||
|
||||
return redirect()->route('admin.store.index')->with('success', 'Store item has been created!');
|
||||
}
|
||||
|
@ -68,10 +68,10 @@ class PaypalProductController extends Controller
|
|||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param PaypalProduct $paypalProduct
|
||||
* @param CreditProduct $creditProduct
|
||||
* @return Response
|
||||
*/
|
||||
public function show(PaypalProduct $paypalProduct)
|
||||
public function show(CreditProduct $creditProduct)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -79,14 +79,14 @@ class PaypalProductController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param PaypalProduct $paypalProduct
|
||||
* @param CreditProduct $creditProduct
|
||||
* @return Application|Factory|View|Response
|
||||
*/
|
||||
public function edit(PaypalProduct $paypalProduct)
|
||||
public function edit(CreditProduct $creditProduct)
|
||||
{
|
||||
return view('admin.store.edit', [
|
||||
'currencyCodes' => config('currency_codes'),
|
||||
'paypalProduct' => $paypalProduct
|
||||
'creditProduct' => $creditProduct
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -94,10 +94,10 @@ class PaypalProductController extends Controller
|
|||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param PaypalProduct $paypalProduct
|
||||
* @param CreditProduct $creditProduct
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, PaypalProduct $paypalProduct)
|
||||
public function update(Request $request, CreditProduct $creditProduct)
|
||||
{
|
||||
$request->validate([
|
||||
"disabled" => "nullable",
|
||||
|
@ -110,19 +110,19 @@ class PaypalProductController extends Controller
|
|||
]);
|
||||
|
||||
$disabled = !is_null($request->input('disabled'));
|
||||
$paypalProduct->update(array_merge($request->all(), ['disabled' => $disabled]));
|
||||
$creditProduct->update(array_merge($request->all(), ['disabled' => $disabled]));
|
||||
|
||||
return redirect()->route('admin.store.index')->with('success', 'Store item has been updated!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param PaypalProduct $paypalProduct
|
||||
* @param CreditProduct $creditProduct
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function disable(Request $request, PaypalProduct $paypalProduct)
|
||||
public function disable(Request $request, CreditProduct $creditProduct)
|
||||
{
|
||||
$paypalProduct->update(['disabled' => !$paypalProduct->disabled]);
|
||||
$creditProduct->update(['disabled' => !$creditProduct->disabled]);
|
||||
|
||||
return redirect()->route('admin.store.index')->with('success', 'Product has been updated!');
|
||||
}
|
||||
|
@ -130,50 +130,50 @@ class PaypalProductController extends Controller
|
|||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param PaypalProduct $paypalProduct
|
||||
* @param CreditProduct $creditProduct
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function destroy(PaypalProduct $paypalProduct)
|
||||
public function destroy(CreditProduct $creditProduct)
|
||||
{
|
||||
$paypalProduct->delete();
|
||||
$creditProduct->delete();
|
||||
return redirect()->back()->with('success', 'Store item has been removed!');
|
||||
}
|
||||
|
||||
|
||||
public function dataTable()
|
||||
{
|
||||
$query = PaypalProduct::query();
|
||||
$query = CreditProduct::query();
|
||||
|
||||
return datatables($query)
|
||||
->addColumn('actions', function (PaypalProduct $paypalProduct) {
|
||||
->addColumn('actions', function (CreditProduct $creditProduct) {
|
||||
return '
|
||||
<a data-content="Edit" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.store.edit', $paypalProduct->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', $creditProduct->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', $paypalProduct->id) . '">
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.destroy', $creditProduct->id) . '">
|
||||
' . csrf_field() . '
|
||||
' . 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>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
->addColumn('disabled', function (PaypalProduct $paypalProduct) {
|
||||
$checked = $paypalProduct->disabled == false ? "checked" : "";
|
||||
->addColumn('disabled', function (CreditProduct $creditProduct) {
|
||||
$checked = $creditProduct->disabled == false ? "checked" : "";
|
||||
return '
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.disable', $paypalProduct->id) . '">
|
||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.disable', $creditProduct->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' . $paypalProduct->id . '">
|
||||
<label class="custom-control-label" for="switch' . $paypalProduct->id . '"></label>
|
||||
<input ' . $checked . ' name="disabled" onchange="this.form.submit()" type="checkbox" class="custom-control-input" id="switch' . $creditProduct->id . '">
|
||||
<label class="custom-control-label" for="switch' . $creditProduct->id . '"></label>
|
||||
</div>
|
||||
</form>
|
||||
';
|
||||
})
|
||||
->editColumn('created_at', function (PaypalProduct $paypalProduct) {
|
||||
return $paypalProduct->created_at ? $paypalProduct->created_at->diffForHumans() : '';
|
||||
->editColumn('created_at', function (CreditProduct $creditProduct) {
|
||||
return $creditProduct->created_at ? $creditProduct->created_at->diffForHumans() : '';
|
||||
})
|
||||
->editColumn('price', function (PaypalProduct $paypalProduct) {
|
||||
return $paypalProduct->formatToCurrency($paypalProduct->price);
|
||||
->editColumn('price', function (CreditProduct $creditProduct) {
|
||||
return $creditProduct->formatToCurrency($creditProduct->price);
|
||||
})
|
||||
->rawColumns(['actions', 'disabled'])
|
||||
->make();
|
|
@ -6,7 +6,7 @@ use App\Events\UserUpdateCreditsEvent;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Configuration;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaypalProduct;
|
||||
use App\Models\CreditProduct;
|
||||
use App\Models\Product;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ConfirmPaymentNotification;
|
||||
|
@ -40,25 +40,25 @@ class PaymentController extends Controller
|
|||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param PaypalProduct $paypalProduct
|
||||
* @param CreditProduct $creditProduct
|
||||
* @return Application|Factory|View
|
||||
*/
|
||||
public function checkOut(Request $request, PaypalProduct $paypalProduct)
|
||||
public function checkOut(Request $request, CreditProduct $creditProduct)
|
||||
{
|
||||
return view('store.checkout')->with([
|
||||
'product' => $paypalProduct,
|
||||
'taxvalue' => $paypalProduct->getTaxValue(),
|
||||
'taxpercent' => $paypalProduct->getTaxPercent(),
|
||||
'total' => $paypalProduct->getTotalPrice()
|
||||
'product' => $creditProduct,
|
||||
'taxvalue' => $creditProduct->getTaxValue(),
|
||||
'taxpercent' => $creditProduct->getTaxPercent(),
|
||||
'total' => $creditProduct->getTotalPrice()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param PaypalProduct $paypalProduct
|
||||
* @param CreditProduct $creditProduct
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function pay(Request $request, PaypalProduct $paypalProduct)
|
||||
public function pay(Request $request, CreditProduct $creditProduct)
|
||||
{
|
||||
$request = new OrdersCreateRequest();
|
||||
$request->prefer('return=representation');
|
||||
|
@ -67,28 +67,28 @@ class PaymentController extends Controller
|
|||
"purchase_units" => [
|
||||
[
|
||||
"reference_id" => uniqid(),
|
||||
"description" => $paypalProduct->description,
|
||||
"description" => $creditProduct->description,
|
||||
"amount" => [
|
||||
"value" => $paypalProduct->getTotalPrice(),
|
||||
'currency_code' => strtoupper($paypalProduct->currency_code),
|
||||
"value" => $creditProduct->getTotalPrice(),
|
||||
'currency_code' => strtoupper($creditProduct->currency_code),
|
||||
'breakdown' =>[
|
||||
'item_total' =>
|
||||
[
|
||||
'currency_code' => strtoupper($paypalProduct->currency_code),
|
||||
'value' => $paypalProduct->price,
|
||||
'currency_code' => strtoupper($creditProduct->currency_code),
|
||||
'value' => $creditProduct->price,
|
||||
],
|
||||
'tax_total' =>
|
||||
[
|
||||
'currency_code' => strtoupper($paypalProduct->currency_code),
|
||||
'value' => $paypalProduct->getTaxValue(),
|
||||
'currency_code' => strtoupper($creditProduct->currency_code),
|
||||
'value' => $creditProduct->getTaxValue(),
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
"application_context" => [
|
||||
"cancel_url" => route('payment.cancel'),
|
||||
"return_url" => route('payment.success', ['product' => $paypalProduct->id]),
|
||||
"cancel_url" => route('payment.PaypalCancel'),
|
||||
"return_url" => route('payment.PaypalSuccess', ['product' => $creditProduct->id]),
|
||||
'brand_name' => config('app.name', 'Laravel'),
|
||||
'shipping_preference' => 'NO_SHIPPING'
|
||||
]
|
||||
|
@ -116,8 +116,8 @@ class PaymentController extends Controller
|
|||
protected function getPayPalClient()
|
||||
{
|
||||
$environment = env('APP_ENV') == 'local'
|
||||
? new SandboxEnvironment($this->getClientId(), $this->getClientSecret())
|
||||
: new ProductionEnvironment($this->getClientId(), $this->getClientSecret());
|
||||
? new SandboxEnvironment($this->getPaypalClientId(), $this->getPaypalClientSecret())
|
||||
: new ProductionEnvironment($this->getPaypalClientId(), $this->getPaypalClientSecret());
|
||||
|
||||
return new PayPalHttpClient($environment);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class PaymentController extends Controller
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getClientId()
|
||||
protected function getPaypalClientId()
|
||||
{
|
||||
return env('APP_ENV') == 'local' ? env('PAYPAL_SANDBOX_CLIENT_ID') : env('PAYPAL_CLIENT_ID');
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ class PaymentController extends Controller
|
|||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getClientSecret()
|
||||
protected function getPaypalClientSecret()
|
||||
{
|
||||
return env('APP_ENV') == 'local' ? env('PAYPAL_SANDBOX_SECRET') : env('PAYPAL_SECRET');
|
||||
}
|
||||
|
@ -141,10 +141,10 @@ class PaymentController extends Controller
|
|||
/**
|
||||
* @param Request $laravelRequest
|
||||
*/
|
||||
public function success(Request $laravelRequest)
|
||||
public function PaypalSuccess(Request $laravelRequest)
|
||||
{
|
||||
/** @var PaypalProduct $paypalProduct */
|
||||
$paypalProduct = PaypalProduct::findOrFail($laravelRequest->input('product'));
|
||||
/** @var CreditProduct $creditProduct */
|
||||
$creditProduct = CreditProduct::findOrFail($laravelRequest->input('product'));
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
|
||||
|
@ -156,7 +156,7 @@ class PaymentController extends Controller
|
|||
if ($response->statusCode == 201 || $response->statusCode == 200) {
|
||||
|
||||
//update credits
|
||||
$user->increment('credits', $paypalProduct->quantity);
|
||||
$user->increment('credits', $creditProduct->quantity);
|
||||
|
||||
//update server limit
|
||||
if (Configuration::getValueByKey('SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||
|
@ -177,12 +177,12 @@ class PaymentController extends Controller
|
|||
'payer_id' => $laravelRequest->input('PayerID'),
|
||||
'type' => 'Credits',
|
||||
'status' => $response->result->status,
|
||||
'amount' => $paypalProduct->quantity,
|
||||
'price' => $paypalProduct->price,
|
||||
'tax_value' => $paypalProduct->getTaxValue(),
|
||||
'tax_percent' => $paypalProduct->getTaxPercent(),
|
||||
'total_price' => $paypalProduct->getTotalPrice(),
|
||||
'currency_code' => $paypalProduct->currency_code,
|
||||
'amount' => $creditProduct->quantity,
|
||||
'price' => $creditProduct->price,
|
||||
'tax_value' => $creditProduct->getTaxValue(),
|
||||
'tax_percent' => $creditProduct->getTaxPercent(),
|
||||
'total_price' => $creditProduct->getTotalPrice(),
|
||||
'currency_code' => $creditProduct->currency_code,
|
||||
'payer' => json_encode($response->result->payer),
|
||||
]);
|
||||
|
||||
|
@ -218,7 +218,7 @@ class PaymentController extends Controller
|
|||
/**
|
||||
* @param Request $request
|
||||
*/
|
||||
public function cancel(Request $request)
|
||||
public function PaypalCancel(Request $request)
|
||||
{
|
||||
return redirect()->route('store.index')->with('success', 'Payment was Canceled');
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Configuration;
|
||||
use App\Models\PaypalProduct;
|
||||
use App\Models\CreditProduct;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class StoreController extends Controller
|
||||
|
@ -27,7 +27,7 @@ class StoreController extends Controller
|
|||
}
|
||||
|
||||
return view('store.index')->with([
|
||||
'products' => PaypalProduct::where('disabled', '=', false)->orderBy('price', 'asc')->get(),
|
||||
'products' => CreditProduct::where('disabled', '=', false)->orderBy('price', 'asc')->get(),
|
||||
'isPaypalSetup' => $isPaypalSetup
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use NumberFormatter;
|
|||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use App\Models\Configuration;
|
||||
|
||||
class PaypalProduct extends Model
|
||||
class CreditProduct extends Model
|
||||
{
|
||||
use LogsActivity;
|
||||
/**
|
||||
|
@ -33,10 +33,10 @@ class PaypalProduct extends Model
|
|||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function (PaypalProduct $paypalProduct) {
|
||||
static::creating(function (CreditProduct $creditProduct) {
|
||||
$client = new Client();
|
||||
|
||||
$paypalProduct->{$paypalProduct->getKeyName()} = $client->generateId($size = 21);
|
||||
$creditProduct->{$creditProduct->getKeyName()} = $client->generateId($size = 21);
|
||||
});
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "laravel/laravel",
|
||||
"name": "controlpanelgg",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"description": "A billing and control panel made for Pterodactyl.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
|
@ -25,6 +25,7 @@
|
|||
"spatie/laravel-activitylog": "^3.16",
|
||||
"spatie/laravel-query-builder": "^3.6",
|
||||
"spatie/laravel-validation-rules": "^3.0",
|
||||
"stripe/stripe-php": "^7.107",
|
||||
"yajra/laravel-datatables-oracle": "~9.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
2301
composer.lock
generated
2301
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePaypalProductsTable extends Migration
|
||||
class CreateCreditProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
@ -13,7 +13,7 @@ class CreatePaypalProductsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('paypal_products', function (Blueprint $table) {
|
||||
Schema::create('credit_products', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->decimal('price')->default(0);
|
||||
|
@ -32,6 +32,6 @@ class CreatePaypalProductsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('paypal_products');
|
||||
Schema::dropIfExists('credit_products');
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDisplayToPaypalProductsTable extends Migration
|
||||
class AddDisplayToCreditProductsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
@ -13,7 +13,7 @@ class AddDisplayToPaypalProductsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('paypal_products', function (Blueprint $table) {
|
||||
Schema::table('credit_products', function (Blueprint $table) {
|
||||
$table->string('display');
|
||||
});
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class AddDisplayToPaypalProductsTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('paypal_products', function (Blueprint $table) {
|
||||
Schema::table('credit_products', function (Blueprint $table) {
|
||||
$table->dropColumn('display');
|
||||
});
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
namespace Database\Seeders;
|
||||
|
||||
use Database\Seeders\Seeds\ProductSeeder;
|
||||
use Database\Seeders\Seeds\PaypalProductSeeder;
|
||||
use Database\Seeders\Seeds\CreditProductSeeder;
|
||||
use Database\Seeders\Seeds\ApplicationApiSeeder;
|
||||
use Database\Seeders\Seeds\UsefulLinksSeeder;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
@ -19,7 +19,7 @@ class ExampleItemsSeeder extends Seeder
|
|||
{
|
||||
$this->call([
|
||||
ProductSeeder::class,
|
||||
PaypalProductSeeder::class,
|
||||
CreditProductSeeder::class,
|
||||
ApplicationApiSeeder::class,
|
||||
UsefulLinksSeeder::class
|
||||
]);
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace Database\Seeders\Seeds;
|
||||
|
||||
use App\Models\PaypalProduct;
|
||||
use App\Models\CreditProduct;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PaypalProductSeeder extends Seeder
|
||||
class CreditProductSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
|
@ -14,7 +14,7 @@ class PaypalProductSeeder extends Seeder
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
PaypalProduct::create([
|
||||
CreditProduct::create([
|
||||
'type' => 'Credits',
|
||||
'display' => '350',
|
||||
'description' => 'Adds 350 credits to your account',
|
||||
|
@ -24,7 +24,7 @@ class PaypalProductSeeder extends Seeder
|
|||
'disabled' => false,
|
||||
]);
|
||||
|
||||
PaypalProduct::create([
|
||||
CreditProduct::create([
|
||||
'type' => 'Credits',
|
||||
'display' => '875 + 125',
|
||||
'description' => 'Adds 1000 credits to your account',
|
||||
|
@ -34,7 +34,7 @@ class PaypalProductSeeder extends Seeder
|
|||
'disabled' => false,
|
||||
]);
|
||||
|
||||
PaypalProduct::create([
|
||||
CreditProduct::create([
|
||||
'type' => 'Credits',
|
||||
'display' => '1750 + 250',
|
||||
'description' => 'Adds 2000 credits to your account',
|
||||
|
@ -44,7 +44,7 @@ class PaypalProductSeeder extends Seeder
|
|||
'disabled' => false,
|
||||
]);
|
||||
|
||||
PaypalProduct::create([
|
||||
CreditProduct::create([
|
||||
'type' => 'Credits',
|
||||
'display' => '3500 + 500',
|
||||
'description' => 'Adds 4000 credits to your account',
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<ol class="breadcrumb float-sm-right">
|
||||
<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 class="text-muted" href="{{route('admin.store.edit' , $paypalProduct->id)}}">Edit</a>
|
||||
<li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.store.edit' , $creditProduct->id)}}">Edit</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
@ -29,12 +29,12 @@
|
|||
<div class="col-lg-6">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{route('admin.store.update' , $paypalProduct->id)}}" method="POST">
|
||||
<form action="{{route('admin.store.update' , $creditProduct->id)}}" method="POST">
|
||||
@csrf
|
||||
@method('PATCH')
|
||||
<div class="d-flex flex-row-reverse">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" @if($paypalProduct->disabled) checked @endif name="disabled" class="custom-control-input custom-control-input-danger"
|
||||
<input type="checkbox" @if($creditProduct->disabled) checked @endif name="disabled" class="custom-control-input custom-control-input-danger"
|
||||
id="switch1">
|
||||
<label class="custom-control-label" for="switch1">Disabled <i data-toggle="popover"
|
||||
data-trigger="hover"
|
||||
|
@ -59,7 +59,7 @@
|
|||
<label for="currency_code">Currency code</label>
|
||||
<select required name="currency_code" id="currency_code" class="custom-select @error('name') is-invalid @enderror">
|
||||
@foreach($currencyCodes as $code)
|
||||
<option @if($paypalProduct->currency_code == $code) selected @endif value="{{$code}}">{{$code}}</option>
|
||||
<option @if($creditProduct->currency_code == $code) selected @endif value="{{$code}}">{{$code}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('currency_code')
|
||||
|
@ -74,7 +74,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label for="price">Price</label>
|
||||
<input value="{{$paypalProduct->price}}" id="price" name="price"
|
||||
<input value="{{$creditProduct->price}}" id="price" name="price"
|
||||
type="number"
|
||||
placeholder="10.00"
|
||||
step="any"
|
||||
|
@ -89,7 +89,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label for="quantity">Quantity</label>
|
||||
<input value="{{$paypalProduct->quantity}}" id="quantity" name="quantity"
|
||||
<input value="{{$creditProduct->quantity}}" id="quantity" name="quantity"
|
||||
type="number"
|
||||
placeholder="1000"
|
||||
class="form-control @error('quantity') is-invalid @enderror"
|
||||
|
@ -106,7 +106,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label for="display">Display</label>
|
||||
<input value="{{$paypalProduct->display}}" id="display" name="display"
|
||||
<input value="{{$creditProduct->display}}" id="display" name="display"
|
||||
type="text"
|
||||
placeholder="750 + 250"
|
||||
class="form-control @error('display') is-invalid @enderror"
|
||||
|
@ -123,7 +123,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<label for="description">Description</label>
|
||||
<input value="{{$paypalProduct->description}}" id="description" name="description"
|
||||
<input value="{{$creditProduct->description}}" id="description" name="description"
|
||||
type="text"
|
||||
placeholder="Adds 1000 credits to your account"
|
||||
class="form-control @error('description') is-invalid @enderror"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@extends('layouts.main')
|
||||
<?php use App\Models\PaypalProduct; ?>
|
||||
<?php use App\Models\CreditProduct; ?>
|
||||
|
||||
@section('content')
|
||||
<!-- CONTENT HEADER -->
|
||||
|
@ -11,8 +11,9 @@
|
|||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a class="" href="{{route('home')}}">Dashboard</a></li>
|
||||
<li class="breadcrumb-item"><a class="text-muted" href="{{route('store.index')}}">Store</a></li>
|
||||
<li class="breadcrumb-item"><a class="" href="{{ route('home') }}">Dashboard</a></li>
|
||||
<li class="breadcrumb-item"><a class="text-muted" href="{{ route('store.index') }}">Store</a>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,33 +31,36 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
@if($isPaypalSetup && $products->count() > 0)
|
||||
@if ($isPaypalSetup && $products->count() > 0)
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-coins mr-2"></i>{{CREDITS_DISPLAY_NAME}}</h5>
|
||||
<h5 class="card-title"><i class="fa fa-coins mr-2"></i>{{ CREDITS_DISPLAY_NAME }}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-striped table-responsive-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Price</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Price</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php /** @var $product PaypalProduct */?>
|
||||
@foreach($products as $product)
|
||||
<tr>
|
||||
<td>{{$product->formatToCurrency($product->price)}}</td>
|
||||
<td>{{strtolower($product->type) == 'credits' ? CREDITS_DISPLAY_NAME : $product->type}}</td>
|
||||
<td><i class="fa fa-coins mr-2"></i>{{$product->display}}</td>
|
||||
<td><a href="{{route('checkout' , $product->id)}}" class="btn btn-info">Purchase</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
<?php /** @var $product CreditProduct */
|
||||
?>
|
||||
@foreach ($products as $product)
|
||||
<tr>
|
||||
<td>{{ $product->formatToCurrency($product->price) }}</td>
|
||||
<td>{{ strtolower($product->type) == 'credits' ? CREDITS_DISPLAY_NAME : $product->type }}
|
||||
</td>
|
||||
<td><i class="fa fa-coins mr-2"></i>{{ $product->display }}</td>
|
||||
<td><a href="{{ route('checkout', $product->id) }}"
|
||||
class="btn btn-info">Purchase</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -65,7 +69,7 @@
|
|||
@else
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<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
|
||||
<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
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Http\Controllers\Admin\ApplicationApiController;
|
|||
use App\Http\Controllers\Admin\ConfigurationController;
|
||||
use App\Http\Controllers\Admin\OverViewController;
|
||||
use App\Http\Controllers\Admin\PaymentController;
|
||||
use App\Http\Controllers\Admin\PaypalProductController;
|
||||
use App\Http\Controllers\Admin\CreditProductController;
|
||||
use App\Http\Controllers\Admin\ProductController;
|
||||
use App\Http\Controllers\Admin\ServerController as AdminServerController;
|
||||
use App\Http\Controllers\Admin\SettingsController;
|
||||
|
@ -61,10 +61,10 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
|||
Route::get('/products/products/{egg?}/{node?}', [FrontProductController::class, 'getProductsBasedOnNode'])->name('products.products.node');
|
||||
|
||||
#payments
|
||||
Route::get('checkout/{paypalProduct}', [PaymentController::class, 'checkOut'])->name('checkout');
|
||||
Route::get('payment/success', [PaymentController::class, 'success'])->name('payment.success');
|
||||
Route::get('payment/cancel', [PaymentController::class, 'cancel'])->name('payment.cancel');
|
||||
Route::get('payment/pay/{paypalProduct}', [PaymentController::class, 'pay'])->name('payment.pay');
|
||||
Route::get('checkout/{creditProduct}', [PaymentController::class, 'checkOut'])->name('checkout');
|
||||
Route::get('payment/PaypalSuccess', [PaymentController::class, 'PaypalSuccess'])->name('payment.PaypalSuccess');
|
||||
Route::get('payment/PaypalCancel', [PaymentController::class, 'PaypalCancel'])->name('payment.PaypalCancel');
|
||||
Route::get('payment/pay/{creditProduct}', [PaymentController::class, 'pay'])->name('payment.pay');
|
||||
|
||||
Route::get('users/logbackin', [UserController::class, 'logBackIn'])->name('users.logbackin');
|
||||
|
||||
|
@ -100,10 +100,10 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
|||
Route::patch('products/disable/{product}', [ProductController::class, 'disable'])->name('products.disable');
|
||||
Route::resource('products', ProductController::class);
|
||||
|
||||
Route::get('store/datatable', [PaypalProductController::class, 'datatable'])->name('store.datatable');
|
||||
Route::patch('store/disable/{paypalProduct}', [PaypalProductController::class, 'disable'])->name('store.disable');
|
||||
Route::resource('store', PaypalProductController::class)->parameters([
|
||||
'store' => 'paypalProduct',
|
||||
Route::get('store/datatable', [CreditProductController::class, 'datatable'])->name('store.datatable');
|
||||
Route::patch('store/disable/{creditProduct}', [CreditProductController::class, 'disable'])->name('store.disable');
|
||||
Route::resource('store', CreditProductController::class)->parameters([
|
||||
'store' => 'creditProduct',
|
||||
]);
|
||||
|
||||
Route::get('payments/datatable', [PaymentController::class, 'datatable'])->name('payments.datatable');
|
||||
|
|
Loading…
Reference in a new issue