浏览代码

Change missing variables

Ferks-FK 2 年之前
父节点
当前提交
f00f5addfe

+ 3 - 1
app/Http/Controllers/Admin/OverViewController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
 
 use App\Classes\PterodactylClient;
 use App\Settings\PterodactylSettings;
+use App\Settings\GeneralSettings;
 use App\Http\Controllers\Controller;
 use App\Models\Pterodactyl\Egg;
 use App\Models\Pterodactyl\Location;
@@ -27,7 +28,7 @@ class OverViewController extends Controller
         $this->pterodactyl = new PterodactylClient($ptero_settings);
     }
     
-    public function index()
+    public function index(GeneralSettings $general_settings)
     {
         //Get counters
         $counters = collect();
@@ -215,6 +216,7 @@ class OverViewController extends Controller
             'deletedNodesPresent' => ($DBnodes->count() != count($pteroNodeIds)) ? true : false,
             'perPageLimit' => ($counters['servers']->total != Server::query()->count()) ? true : false,
             'tickets' => $tickets,
+            'credits_display_name' => $general_settings->credits_display_name
         ]);
     }
 

+ 3 - 1
app/Http/Controllers/Admin/ShopProductController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers\Admin;
 
 use App\Models\ShopProduct;
+use App\Settings\GeneralSettings;
 use App\Settings\LocaleSettings;
 use Illuminate\Contracts\Foundation\Application;
 use Illuminate\Contracts\View\Factory;
@@ -44,10 +45,11 @@ class ShopProductController extends Controller
      *
      * @return Application|Factory|View|Response
      */
-    public function create()
+    public function create(GeneralSettings $general_settings)
     {
         return view('admin.store.create', [
             'currencyCodes' => config('currency_codes'),
+            'credits_display_name' => $general_settings->credits_display_name
         ]);
     }
 

+ 9 - 5
app/Http/Controllers/Admin/UserController.php

@@ -9,6 +9,7 @@ use App\Notifications\DynamicNotification;
 use App\Settings\LocaleSettings;
 use App\Settings\PterodactylSettings;
 use App\Classes\PterodactylClient;
+use App\Settings\GeneralSettings;
 use Exception;
 use Illuminate\Contracts\Foundation\Application;
 use Illuminate\Contracts\View\Factory;
@@ -41,10 +42,11 @@ class UserController extends Controller
      * @param  Request  $request
      * @return Application|Factory|View|Response
      */
-    public function index(LocaleSettings $locale_settings)
+    public function index(LocaleSettings $locale_settings, GeneralSettings $general_settings)
     {
         return view('admin.users.index', [
-            'locale_datatables' => $locale_settings->datatables
+            'locale_datatables' => $locale_settings->datatables,
+            'credits_display_name' => $general_settings->credits_display_name
         ]);
     }
 
@@ -54,7 +56,7 @@ class UserController extends Controller
      * @param  User  $user
      * @return Application|Factory|View|Response
      */
-    public function show(User $user, LocaleSettings $locale_settings)
+    public function show(User $user, LocaleSettings $locale_settings, GeneralSettings $general_settings)
     {
         //QUERY ALL REFERRALS A USER HAS
         //i am not proud of this at all.
@@ -68,7 +70,8 @@ class UserController extends Controller
         return view('admin.users.show')->with([
             'user' => $user,
             'referrals' => $allReferals,
-            'locale_datatables' => $locale_settings->datatables
+            'locale_datatables' => $locale_settings->datatables,
+            'credits_display_name' => $general_settings->credits_display_name
         ]);
     }
 
@@ -103,10 +106,11 @@ class UserController extends Controller
      * @param  User  $user
      * @return Application|Factory|View|Response
      */
-    public function edit(User $user)
+    public function edit(User $user, GeneralSettings $general_settings)
     {
         return view('admin.users.edit')->with([
             'user' => $user,
+            'credits_display_name' => $general_settings->credits_display_name
         ]);
     }
 

+ 13 - 8
app/Http/Controllers/Admin/VoucherController.php

@@ -6,6 +6,7 @@ use App\Events\UserUpdateCreditsEvent;
 use App\Http\Controllers\Controller;
 use App\Models\User;
 use App\Models\Voucher;
+use App\Settings\GeneralSettings;
 use App\Settings\LocaleSettings;
 use Illuminate\Contracts\Foundation\Application;
 use Illuminate\Contracts\View\Factory;
@@ -23,10 +24,11 @@ class VoucherController extends Controller
      *
      * @return Application|Factory|View
      */
-    public function index(LocaleSettings $locale_settings)
+    public function index(LocaleSettings $locale_settings, GeneralSettings $general_settings)
     {
         return view('admin.vouchers.index', [
-            'locale_datatables' => $locale_settings->datatables
+            'locale_datatables' => $locale_settings->datatables,
+            'credits_display_name' => $general_settings->credits_display_name
         ]);
     }
 
@@ -35,9 +37,11 @@ class VoucherController extends Controller
      *
      * @return Application|Factory|View
      */
-    public function create()
+    public function create(GeneralSettings $general_settings)
     {
-        return view('admin.vouchers.create');
+        return view('admin.vouchers.create', [
+            'credits_display_name' => $general_settings->credits_display_name
+        ]);
     }
 
     /**
@@ -78,10 +82,11 @@ class VoucherController extends Controller
      * @param  Voucher  $voucher
      * @return Application|Factory|View
      */
-    public function edit(Voucher $voucher)
+    public function edit(Voucher $voucher, GeneralSettings $general_settings)
     {
         return view('admin.vouchers.edit', [
             'voucher' => $voucher,
+            'credits_display_name' => $general_settings->credits_display_name
         ]);
     }
 
@@ -134,7 +139,7 @@ class VoucherController extends Controller
      *
      * @throws ValidationException
      */
-    public function redeem(Request $request)
+    public function redeem(Request $request, GeneralSettings $general_settings)
     {
         //general validations
         $request->validate([
@@ -165,7 +170,7 @@ class VoucherController extends Controller
 
         if ($request->user()->credits + $voucher->credits >= 99999999) {
             throw ValidationException::withMessages([
-                'code' => "You can't redeem this voucher because you would exceed the  limit of ".CREDITS_DISPLAY_NAME,
+                'code' => "You can't redeem this voucher because you would exceed the  limit of " . $general_settings->credits_display_name,
             ]);
         }
 
@@ -175,7 +180,7 @@ class VoucherController extends Controller
         event(new UserUpdateCreditsEvent($request->user()));
 
         return response()->json([
-            'success' => "{$voucher->credits} ".CREDITS_DISPLAY_NAME.' '.__('have been added to your balance!'),
+            'success' => "{$voucher->credits} ". $general_settings->credits_display_name .' '.__('have been added to your balance!'),
         ]);
     }
 

+ 2 - 2
themes/default/views/admin/overview/index.blade.php

@@ -85,7 +85,7 @@
                                 class="fas fa-coins text-white"></i></span>
 
                         <div class="info-box-content">
-                            <span class="info-box-text">{{__('Total')}} {{CREDITS_DISPLAY_NAME}}</span>
+                            <span class="info-box-text">{{__('Total')}} {{ $credits_display_name }}</span>
                             <span class="info-box-number">{{$counters['credits']}}</span>
                         </div>
                         <!-- /.info-box-content -->
@@ -240,7 +240,7 @@
                                     <th>{{__('Node')}}</th>
                                     <th>{{__('Server count')}}</th>
                                     <th>{{__('Resource usage')}}</th>
-                                    <th>{{CREDITS_DISPLAY_NAME . ' ' . __('Usage')}}</th>
+                                    <th>{{ $credits_display_name . ' ' . __('Usage')}}</th>
                                 </tr>
                                 </thead>
                                 <tbody>

+ 1 - 1
themes/default/views/admin/products/create.blade.php

@@ -63,7 +63,7 @@
                                         </div>
 
                                         <div class="form-group">
-                                            <label for="price">{{__('Price in')}} {{CREDITS_DISPLAY_NAME}}</label>
+                                            <label for="price">{{__('Price in')}} {{ $credits_display_name }}</label>
                                             <input value="{{$product->price ??  old('price')}}" id="price" name="price" step=".01"
                                                    type="number"
                                                    class="form-control @error('price') is-invalid @enderror"

+ 1 - 1
themes/default/views/admin/store/create.blade.php

@@ -49,7 +49,7 @@
                                     <label for="type">{{__('Type')}}</label>
                                     <select required name="type" id="type"
                                             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>
                                     @error('name')

+ 1 - 1
themes/default/views/admin/users/edit.blade.php

@@ -70,7 +70,7 @@
                                     </div>
                                 </div>
                                 <div class="form-group">
-                                    <label for="credits">{{CREDITS_DISPLAY_NAME}}</label>
+                                    <label for="credits">{{ $credits_display_name }}</label>
                                     <input value="{{$user->credits}}" id="credits" name="credits" step="any" min="0"
                                            max="99999999"
                                            type="number" class="form-control @error('credits') is-invalid @enderror"

+ 15 - 15
themes/default/views/admin/users/index.blade.php

@@ -38,21 +38,21 @@
 
                     <table id="datatable" class="table table-striped">
                         <thead>
-                            <tr>
-                                <th>discordId</th>
-                                <th>ip</th>
-                                <th>pterodactyl_id</th>
-                                <th>{{ __('Avatar') }}</th>
-                                <th>{{ __('Name') }}</th>
-                                <th>{{ __('Role') }}</th>
-                                <th>{{ __('Email') }}</th>
-                                <th>{{ CREDITS_DISPLAY_NAME }}</th>
-                                <th>{{ __('Servers') }}</th>
-                                <th>{{ __('Referrals') }}</th>
-                                <th>{{ __('Verified') }}</th>
-                                <th>{{ __('Last seen') }}</th>
-                                <th></th>
-                            </tr>
+                        <tr>
+                            <th>discordId</th>
+                            <th>ip</th>
+                            <th>pterodactyl_id</th>
+                            <th>{{__('Avatar')}}</th>
+                            <th>{{__('Name')}}</th>
+                            <th>{{__('Role')}}</th>
+                            <th>{{__('Email')}}</th>
+                            <th>{{ $credits_display_name }}</th>
+                            <th>{{__('Servers')}}</th>
+                            <th>{{__('Referrals')}}</th>
+                            <th>{{__('Verified')}}</th>
+                            <th>{{__('Last seen')}}</th>
+                            <th></th>
+                        </tr>
                         </thead>
                         <tbody>
                         </tbody>

+ 1 - 1
themes/default/views/admin/users/show.blade.php

@@ -151,7 +151,7 @@
                         <div class="col-lg-6">
                             <div class="row">
                                 <div class="col-lg-4">
-                                    <label>{{CREDITS_DISPLAY_NAME}}</label>
+                                    <label>{{ $credits_display_name }}</label>
                                 </div>
                                 <div class="col-lg-8">
                                        <span style="max-width: 250px;" class="d-inline-block text-truncate">

+ 1 - 1
themes/default/views/admin/vouchers/create.blade.php

@@ -54,7 +54,7 @@
                                 </div>
 
                                 <div class="form-group">
-                                    <label for="credits">* {{CREDITS_DISPLAY_NAME}}</label>
+                                    <label for="credits">* {{ $credits_display_name }}</label>
                                     <input value="{{old('credits')}}" placeholder="500" id="credits" name="credits"
                                            type="number" step="any" min="0" max="99999999"
                                            class="form-control @error('credits') is-invalid @enderror">

+ 1 - 1
themes/default/views/admin/vouchers/edit.blade.php

@@ -55,7 +55,7 @@
                                 </div>
 
                                 <div class="form-group">
-                                    <label for="credits">{{CREDITS_DISPLAY_NAME}} *</label>
+                                    <label for="credits">{{ $credits_display_name }} *</label>
                                     <input value="{{$voucher->credits}}" placeholder="500" id="credits" name="credits"
                                            type="number" step="any" min="0" max="99999999"
                                            class="form-control @error('credits') is-invalid @enderror">

+ 1 - 1
themes/default/views/admin/vouchers/index.blade.php

@@ -42,7 +42,7 @@
                             <th>{{__('Status')}}</th>
                             <th>{{__('Code')}}</th>
                             <th>{{__('Memo')}}</th>
-                            <th>{{CREDITS_DISPLAY_NAME}}</th>
+                            <th>{{ $credits_display_name }}</th>
                             <th>{{__('Used / Uses')}}</th>
                             <th>{{__('Expires')}}</th>
                             <th></th>