From 16ca76090118d067cbb2e05e0446984dd4990790 Mon Sep 17 00:00:00 2001 From: Ferks-FK Date: Fri, 3 Feb 2023 16:38:03 +0000 Subject: [PATCH] Several modifications, something already works --- ...{Pterodactyl.php => PterodactylClient.php} | 113 ++++--- .../Controllers/Admin/OverViewController.php | 21 +- app/Http/Controllers/HomeController.php | 8 +- app/Models/{ => Pterodactyl}/Egg.php | 11 +- app/Models/{ => Pterodactyl}/Location.php | 7 +- app/Models/{ => Pterodactyl}/Nest.php | 7 +- app/Models/{ => Pterodactyl}/Node.php | 7 +- app/Settings/DiscordSettings.php | 9 + app/Settings/GeneralSettings.php | 37 ++- app/Settings/MailSettings.php | 7 + app/Settings/PterodactylSettings.php | 18 ++ themes/default/views/home.blade.php | 295 ++++++++++-------- 12 files changed, 328 insertions(+), 212 deletions(-) rename app/Classes/{Pterodactyl.php => PterodactylClient.php} (71%) rename app/Models/{ => Pterodactyl}/Egg.php (92%) rename app/Models/{ => Pterodactyl}/Location.php (92%) rename app/Models/{ => Pterodactyl}/Nest.php (92%) rename app/Models/{ => Pterodactyl}/Node.php (93%) diff --git a/app/Classes/Pterodactyl.php b/app/Classes/PterodactylClient.php similarity index 71% rename from app/Classes/Pterodactyl.php rename to app/Classes/PterodactylClient.php index 89ae028c..8aa85a35 100644 --- a/app/Classes/Pterodactyl.php +++ b/app/Classes/PterodactylClient.php @@ -2,46 +2,63 @@ namespace App\Classes; -use App\Models\Egg; -use App\Models\Nest; -use App\Models\Node; +use App\Models\Pterodactyl\Egg; +use App\Models\Pterodactyl\Nest; +use App\Models\Pterodactyl\Node; use App\Models\Product; use App\Models\Server; -use App\Models\User; use Exception; use Illuminate\Http\Client\PendingRequest; use Illuminate\Http\Client\Response; use Illuminate\Support\Facades\Http; +use App\Settings\PterodactylSettings; -class Pterodactyl +class PterodactylClient { //TODO: Extend error handling (maybe logger for more errors when debugging) + public int $per_page_limit = 200; + + public PendingRequest $client; + + public PendingRequest $client_admin; + + public function __construct(PterodactylSettings $ptero_settings) + { + try { + $this->client = $this->client($ptero_settings); + $this->client_admin = $this->clientAdmin($ptero_settings); + $this->per_page_limit = $ptero_settings->per_page_limit; + } + catch (Exception $exception) { + logger('Failed to construct Pterodactyl client, Settings table not available?', ['exception' => $exception]); + } + } /** * @return PendingRequest */ - public static function client() + public function client(PterodactylSettings $ptero_settings) { return Http::withHeaders([ - 'Authorization' => 'Bearer ' . config('SETTINGS::SYSTEM:PTERODACTYL:TOKEN'), + 'Authorization' => 'Bearer ' . $ptero_settings->user_token, 'Content-type' => 'application/json', 'Accept' => 'Application/vnd.pterodactyl.v1+json', - ])->baseUrl(config('SETTINGS::SYSTEM:PTERODACTYL:URL') . '/api'); + ])->baseUrl($ptero_settings->getUrl() . 'api' . '/'); } - public static function clientAdmin() + public function clientAdmin(PterodactylSettings $ptero_settings) { return Http::withHeaders([ - 'Authorization' => 'Bearer ' . config('SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN'), + 'Authorization' => 'Bearer ' . $ptero_settings->admin_token, 'Content-type' => 'application/json', 'Accept' => 'Application/vnd.pterodactyl.v1+json', - ])->baseUrl(config('SETTINGS::SYSTEM:PTERODACTYL:URL') . '/api'); + ])->baseUrl($ptero_settings->getUrl() . 'api' . '/'); } /** * @return Exception */ - private static function getException(string $message = '', int $status = 0): Exception + private function getException(string $message = '', int $status = 0): Exception { if ($status == 404) { return new Exception('Ressource does not exist on pterodactyl - ' . $message, 404); @@ -68,10 +85,10 @@ class Pterodactyl * * @throws Exception */ - public static function getEggs(Nest $nest) + public function getEggs(Nest $nest) { try { - $response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables&per_page=" . config('SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT')); + $response = $this->client_admin->get("application/nests/{$nest->id}/eggs?include=nest,variables&per_page=" . $this->per_page_limit); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -87,10 +104,10 @@ class Pterodactyl * * @throws Exception */ - public static function getNodes() + public function getNodes() { try { - $response = self::client()->get('/application/nodes?per_page=' . config('SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT')); + $response = $this->client_admin->get('application/nodes?per_page=' . $this->per_page_limit); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -107,10 +124,10 @@ class Pterodactyl * @throws Exception * @description Returns the infos of a single node */ - public static function getNode($id) + public function getNode($id) { try { - $response = self::client()->get('/application/nodes/' . $id); + $response = $this->client_admin->get('application/nodes/' . $id); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -121,10 +138,10 @@ class Pterodactyl return $response->json()['attributes']; } - public static function getServers() + public function getServers() { try { - $response = self::client()->get('/application/servers?per_page=' . config('SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT')); + $response = $this->client_admin->get('application/servers?per_page=' . $this->per_page_limit); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -140,10 +157,10 @@ class Pterodactyl * * @throws Exception */ - public static function getNests() + public function getNests() { try { - $response = self::client()->get('/application/nests?per_page=' . config('SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT')); + $response = $this->client_admin->get('application/nests?per_page=' . $this->per_page_limit); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -159,10 +176,10 @@ class Pterodactyl * * @throws Exception */ - public static function getLocations() + public function getLocations() { try { - $response = self::client()->get('/application/locations?per_page=' . config('SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT')); + $response = $this->client_admin->get('application/locations?per_page=' . $this->per_page_limit); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -179,7 +196,7 @@ class Pterodactyl * * @throws Exception */ - public static function getFreeAllocationId(Node $node) + public function getFreeAllocationId(Node $node) { return self::getFreeAllocations($node)[0]['attributes']['id'] ?? null; } @@ -190,7 +207,7 @@ class Pterodactyl * * @throws Exception */ - public static function getFreeAllocations(Node $node) + public function getFreeAllocations(Node $node) { $response = self::getAllocations($node); $freeAllocations = []; @@ -214,11 +231,11 @@ class Pterodactyl * * @throws Exception */ - public static function getAllocations(Node $node) + public function getAllocations(Node $node) { $per_page = config('SETTINGS::SERVER:ALLOCATION_LIMIT', 200); try { - $response = self::client()->get("/application/nodes/{$node->id}/allocations?per_page={$per_page}"); + $response = $this->client_admin->get("application/nodes/{$node->id}/allocations?per_page={$per_page}"); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -233,7 +250,7 @@ class Pterodactyl * @param string $route * @return string */ - public static function url(string $route): string + public function url(string $route): string { return config('SETTINGS::SYSTEM:PTERODACTYL:URL') . $route; } @@ -244,9 +261,9 @@ class Pterodactyl * @param int $allocationId * @return Response */ - public static function createServer(Server $server, Egg $egg, int $allocationId) + public function createServer(Server $server, Egg $egg, int $allocationId) { - return self::client()->post('/application/servers', [ + return $this->client_admin->post('application/servers', [ 'name' => $server->name, 'external_id' => $server->id, 'user' => $server->user->pterodactyl_id, @@ -272,10 +289,10 @@ class Pterodactyl ]); } - public static function suspendServer(Server $server) + public function suspendServer(Server $server) { try { - $response = self::client()->post("/application/servers/$server->pterodactyl_id/suspend"); + $response = $this->client_admin->post("application/servers/$server->pterodactyl_id/suspend"); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -286,10 +303,10 @@ class Pterodactyl return $response; } - public static function unSuspendServer(Server $server) + public function unSuspendServer(Server $server) { try { - $response = self::client()->post("/application/servers/$server->pterodactyl_id/unsuspend"); + $response = $this->client_admin->post("application/servers/$server->pterodactyl_id/unsuspend"); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -309,7 +326,7 @@ class Pterodactyl public function getUser(int $pterodactylId) { try { - $response = self::client()->get("/application/users/{$pterodactylId}"); + $response = $this->client_admin->get("application/users/{$pterodactylId}"); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -326,10 +343,10 @@ class Pterodactyl * @param int $pterodactylId * @return mixed */ - public static function getServerAttributes(int $pterodactylId, bool $deleteOn404 = false) + public function getServerAttributes(int $pterodactylId, bool $deleteOn404 = false) { try { - $response = self::client()->get("/application/servers/{$pterodactylId}?include=egg,node,nest,location"); + $response = $this->client_admin->get("application/servers/{$pterodactylId}?include=egg,node,nest,location"); } catch (Exception $e) { throw self::getException($e->getMessage()); } @@ -356,9 +373,9 @@ class Pterodactyl * @param Product $product * @return Response */ - public static function updateServer(Server $server, Product $product) + public function updateServer(Server $server, Product $product) { - return self::client()->patch("/application/servers/{$server->pterodactyl_id}/build", [ + return $this->client_admin->patch("application/servers/{$server->pterodactyl_id}/build", [ 'allocation' => $server->allocation, 'memory' => $product->memory, 'swap' => $product->swap, @@ -381,9 +398,9 @@ class Pterodactyl * @param Server $server * @return mixed */ - public static function updateServerOwner(Server $server, int $userId) + public function updateServerOwner(Server $server, int $userId) { - return self::client()->patch("/application/servers/{$server->pterodactyl_id}/details", [ + return $this->client_admin->patch("application/servers/{$server->pterodactyl_id}/details", [ 'name' => $server->name, 'user' => $userId, ]); @@ -396,9 +413,9 @@ class Pterodactyl * @param string $action * @return Response */ - public static function powerAction(Server $server, $action) + public function powerAction(Server $server, $action) { - return self::clientAdmin()->post("/client/servers/{$server->identifier}/power", [ + return $this->client->post("client/servers/{$server->identifier}/power", [ 'signal' => $action, ]); } @@ -406,9 +423,9 @@ class Pterodactyl /** * Get info about user */ - public static function getClientUser() + public function getClientUser() { - return self::clientAdmin()->get('/client/account'); + return $this->client->get('client/account'); } /** @@ -419,10 +436,10 @@ class Pterodactyl * @param int $requireDisk * @return bool */ - public static function checkNodeResources(Node $node, int $requireMemory, int $requireDisk) + public function checkNodeResources(Node $node, int $requireMemory, int $requireDisk) { try { - $response = self::client()->get("/application/nodes/{$node->id}"); + $response = $this->client_admin->get("application/nodes/{$node->id}"); } catch (Exception $e) { throw self::getException($e->getMessage()); } diff --git a/app/Http/Controllers/Admin/OverViewController.php b/app/Http/Controllers/Admin/OverViewController.php index 280b59d4..8f89b587 100644 --- a/app/Http/Controllers/Admin/OverViewController.php +++ b/app/Http/Controllers/Admin/OverViewController.php @@ -2,12 +2,13 @@ namespace App\Http\Controllers\Admin; -use App\Classes\Pterodactyl; +use App\Classes\PterodactylClient; +use App\Settings\PterodactylSettings; use App\Http\Controllers\Controller; -use App\Models\Egg; -use App\Models\Location; -use App\Models\Nest; -use App\Models\Node; +use App\Models\Pterodactyl\Egg; +use App\Models\Pterodactyl\Location; +use App\Models\Pterodactyl\Nest; +use App\Models\Pterodactyl\Node; use App\Models\Payment; use App\Models\Product; use App\Models\Server; @@ -19,8 +20,10 @@ class OverViewController extends Controller { public const TTL = 86400; - public function index() + public function index(PterodactylSettings $ptero_settings) { + //Prepare pterodactyl client + $pterodactyl_client = new PterodactylClient($ptero_settings); //Get counters $counters = collect(); //Set basic variables in the collection @@ -134,7 +137,7 @@ class OverViewController extends Controller //Get node information and prepare collection $pteroNodeIds = []; - foreach (Pterodactyl::getNodes() as $pteroNode) { + foreach ($pterodactyl_client->getNodes() as $pteroNode) { array_push($pteroNodeIds, $pteroNode['attributes']['id']); } $nodes = collect(); @@ -145,7 +148,7 @@ class OverViewController extends Controller } //Check if node exists on pterodactyl too, if not, skip $nodes->put($nodeId, collect()); $nodes[$nodeId]->name = $DBnode['name']; - $pteroNode = Pterodactyl::getNode($nodeId); + $pteroNode = $pterodactyl_client->getNode($nodeId); $nodes[$nodeId]->usagePercent = round(max($pteroNode['allocated_resources']['memory'] / ($pteroNode['memory'] * ($pteroNode['memory_overallocate'] + 100) / 100), $pteroNode['allocated_resources']['disk'] / ($pteroNode['disk'] * ($pteroNode['disk_overallocate'] + 100) / 100)) * 100, 2); $counters['totalUsagePercent'] += $nodes[$nodeId]->usagePercent; @@ -156,7 +159,7 @@ class OverViewController extends Controller } $counters['totalUsagePercent'] = ($DBnodes->count()) ? round($counters['totalUsagePercent'] / $DBnodes->count(), 2) : 0; - foreach (Pterodactyl::getServers() as $server) { //gets all servers from Pterodactyl and calculates total of credit usage for each node separately + total + foreach ($pterodactyl_client->getServers() as $server) { //gets all servers from Pterodactyl and calculates total of credit usage for each node separately + total $nodeId = $server['attributes']['node']; if ($CPServer = Server::query()->where('pterodactyl_id', $server['attributes']['id'])->first()) { diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 5a511758..dc2de500 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -11,6 +11,9 @@ use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\URL; +use App\Settings\GeneralSettings; +use App\Settings\WebsiteSettings; +use App\Settings\ReferralSettings; class HomeController extends Controller { @@ -87,7 +90,7 @@ class HomeController extends Controller } /** Show the application dashboard. */ - public function index(Request $request) + public function index(GeneralSettings $general_settings, WebsiteSettings $website_settings, ReferralSettings $referral_settings) { $usage = Auth::user()->creditUsage(); $credits = Auth::user()->Credits(); @@ -118,6 +121,9 @@ class HomeController extends Controller 'numberOfReferrals' => DB::table('user_referrals')->where('referral_id', '=', Auth::user()->id)->count(), 'partnerDiscount' => PartnerDiscount::where('user_id', Auth::user()->id)->first(), 'myDiscount' => PartnerDiscount::getDiscount(), + 'general_settings' => $general_settings, + 'website_settings' => $website_settings, + 'referral_settings' => $referral_settings ]); } } diff --git a/app/Models/Egg.php b/app/Models/Pterodactyl/Egg.php similarity index 92% rename from app/Models/Egg.php rename to app/Models/Pterodactyl/Egg.php index 23bf34ef..55170045 100644 --- a/app/Models/Egg.php +++ b/app/Models/Pterodactyl/Egg.php @@ -1,12 +1,13 @@ each(function (Nest $nest) { - $eggs = Pterodactyl::getEggs($nest); + $client = app(PterodactylClient::class); + Nest::all()->each(function (Nest $nest) use ($client) { + $eggs = $client->getEggs($nest); foreach ($eggs as $egg) { $array = []; diff --git a/app/Models/Location.php b/app/Models/Pterodactyl/Location.php similarity index 92% rename from app/Models/Location.php rename to app/Models/Pterodactyl/Location.php index a020c73f..8d4bf7c1 100644 --- a/app/Models/Location.php +++ b/app/Models/Pterodactyl/Location.php @@ -1,8 +1,8 @@ getLocations(); //map response $locations = array_map(function ($val) { diff --git a/app/Models/Nest.php b/app/Models/Pterodactyl/Nest.php similarity index 92% rename from app/Models/Nest.php rename to app/Models/Pterodactyl/Nest.php index 06c5ce26..699c52db 100644 --- a/app/Models/Nest.php +++ b/app/Models/Pterodactyl/Nest.php @@ -1,8 +1,8 @@ getNests(); //map response $nests = array_map(function ($nest) { diff --git a/app/Models/Node.php b/app/Models/Pterodactyl/Node.php similarity index 93% rename from app/Models/Node.php rename to app/Models/Pterodactyl/Node.php index 01eee0ea..d66dbce3 100644 --- a/app/Models/Node.php +++ b/app/Models/Pterodactyl/Node.php @@ -1,8 +1,8 @@ getNodes(); //map response $nodes = array_map(function ($node) { diff --git a/app/Settings/DiscordSettings.php b/app/Settings/DiscordSettings.php index 3065c05c..bcc51498 100644 --- a/app/Settings/DiscordSettings.php +++ b/app/Settings/DiscordSettings.php @@ -22,4 +22,13 @@ class DiscordSettings extends Settings { return 'discord'; } + + public static function encrypted(): array + { + return [ + 'bot_token', + 'client_id', + 'client_secret' + ]; + } } \ No newline at end of file diff --git a/app/Settings/GeneralSettings.php b/app/Settings/GeneralSettings.php index 19ebf8ba..e311986f 100644 --- a/app/Settings/GeneralSettings.php +++ b/app/Settings/GeneralSettings.php @@ -6,24 +6,43 @@ use Spatie\LaravelSettings\Settings; class GeneralSettings extends Settings { - //instead of showing Credits, show something like example 'Emeralds' - public string $credits_display_name; - //url to the main site public string $main_site; - //check the ip during register for dupes - public bool $register_ip_check; + public string $credits_display_name; - //the initial amount of credits given to the user on register public float $initial_user_credits; - //the initial amount of credits given to the user on register - public float $initial_server_limit; - //the initial role given to the user on register + + public int $initial_server_limit; + + public string $recaptcha_site_key; + + public string $recaptcha_secret_key; + + public bool $recaptcha_enabled; + + public string $phpmyadmin_url; + + public bool $alert_enabled; + + public string $alert_type; + + public string $alert_message; + + public string $theme; + //public int $initial_user_role; wait for Roles & Permissions PR. public static function group(): string { return 'general'; } + + public static function encrypted(): array + { + return [ + 'recaptcha_site_key', + 'recaptcha_secret_key' + ]; + } } \ No newline at end of file diff --git a/app/Settings/MailSettings.php b/app/Settings/MailSettings.php index 173a1f63..2cb8ced8 100644 --- a/app/Settings/MailSettings.php +++ b/app/Settings/MailSettings.php @@ -28,4 +28,11 @@ class MailSettings extends Settings { return 'mail'; } + + public static function encrypted(): array + { + return [ + 'mail_password' + ]; + } } \ No newline at end of file diff --git a/app/Settings/PterodactylSettings.php b/app/Settings/PterodactylSettings.php index d982e529..c705f1ea 100644 --- a/app/Settings/PterodactylSettings.php +++ b/app/Settings/PterodactylSettings.php @@ -18,4 +18,22 @@ class PterodactylSettings extends Settings { return 'pterodactyl'; } + + public static function encrypted(): array + { + return [ + 'admin_token', + 'user_token' + ]; + } + + /** + * Get url with ensured ending backslash + * + * @return string + */ + public function getUrl(): string + { + return str_ends_with($this->panel_url, '/') ? $this->panel_url : $this->panel_url . '/'; + } } \ No newline at end of file diff --git a/themes/default/views/home.blade.php b/themes/default/views/home.blade.php index 720e39aa..69c14089 100644 --- a/themes/default/views/home.blade.php +++ b/themes/default/views/home.blade.php @@ -18,18 +18,19 @@ - @if(!file_exists(base_path()."/install.lock") && Auth::User()->role == "admin") + @if (!file_exists(base_path() . '/install.lock') && Auth::User()->role == 'admin')

{{ __('The installer is not locked!') }}

-

{{ __('please create a file called "install.lock" in your dashboard Root directory. Otherwise no settings will be loaded!') }}

- +

{{ __('please create a file called "install.lock" in your dashboard Root directory. Otherwise no settings will be loaded!') }} +

+
@endif - @if(config("SETTINGS::SYSTEM:ALERT_ENABLED") && !empty(config("SETTINGS::SYSTEM:ALERT_MESSAGE"))) - - @if ($credits > 0.01 and $usage > 0) + @if ($credits > 0.01 && $usage > 0)
{{ __('Out of Credits in', ['credits' => CREDITS_DISPLAY_NAME]) }} + class="info-box-text">{{ __('Out of Credits in', ['credits' => $general_settings->credits_display_name]) }} {{ $boxText }}{{ $unit }}
@@ -106,7 +108,7 @@
- @if(config("SETTINGS::SYSTEM:MOTD_ENABLED") == "true") + @if ($website_settings->motd_enabled)

@@ -116,27 +118,43 @@

- {!! config('SETTINGS::SYSTEM:MOTD_MESSAGE', '') !!} + {!! $website_settings->motd_message !!}
@endif - @if(config("SETTINGS::SYSTEM:USEFULLINKS_ENABLED") == "true") -
-
-

- - {{ __('Useful Links') }} -

+ @if ($website_settings->useful_links_enabled) +
+
+

+ + {{ __('Useful Links') }} +

+
+ +
+ @foreach ($useful_links as $useful_link) +
+ +
+ + {{ $useful_link->title }} + +
+ {!! $useful_link->description !!} +
+ @endforeach +
+
@foreach ($useful_links_dashboard as $useful_link) -
- @endif -
- + @endif + +
+ -
+
+
+
+

+ + {{ __('Activity Logs') }} +

+
+ +
+
    + @foreach (Auth::user()->actions()->take(8)->orderBy('created_at', 'desc')->get() as $log) +
  • + + @if (str_starts_with($log->description, 'created')) + + @elseif(str_starts_with($log->description, 'redeemed')) + + @elseif(str_starts_with($log->description, 'deleted')) + + @elseif(str_starts_with($log->description, 'gained')) + + @elseif(str_starts_with($log->description, 'updated')) + + @endif + {{ explode('\\', $log->subject_type)[2] }} + {{ ucfirst($log->description) }} + + + {{ $log->created_at->diffForHumans() }} + +
  • + @endforeach +
+
+ +
+ + @if ($referral_settings->enabled) +

- - {{ __('Activity Logs') }} + + {{ __('Partner program') }}

-
    - @foreach (Auth::user()->actions()->take(8)->orderBy('created_at', 'desc')->get() as $log) -
  • - - @if(str_starts_with($log->description,"created")) - - @elseif(str_starts_with($log->description,"redeemed")) - - @elseif(str_starts_with($log->description,"deleted")) - - @elseif(str_starts_with($log->description,"gained")) - - @elseif(str_starts_with($log->description,"updated")) - - @endif - {{ explode('\\', $log->subject_type)[2] }} - {{ ucfirst($log->description) }} + @if ( + ($referral_settings->allowed == 'client' && Auth::user()->role != 'member') || + $referral_settings->allowed == 'everyone') +
    +
    + + + {{ __('Your referral URL') }}: + + {{ __('Click to copy') }} + - - {{ $log->created_at->diffForHumans() }} - -
  • - @endforeach -
+
+
+ {{ __('Number of referred users:') }} + {{ $numberOfReferrals }} +
+
+ @if ($partnerDiscount) +
+ + + + + + + + + + + + + + + + + +
{{ __('Your discount') }}{{ __('Discount for your new users') }}{{ __('Reward per registered user') }}{{ __('New user payment commision') }}
{{ $partnerDiscount->partner_discount }}%{{ $partnerDiscount->registered_user_discount }}%{{ $referral_settings->reward }} + {{ $general_settings->credits_display_name }}{{ $partnerDiscount->referral_system_commission == -1 ? $referral_settings->percentage : $partnerDiscount->referral_system_commission }}% +
+
+ @else +
+ + + + + + + + + + + + + +
{{ __('Reward per registered user') }}{{ __('New user payment commision') }}
{{ $referral_settings->reward }} + {{ $general_settings->credits_display_name }}{{ $referral_settings->percentage }}%
+
+ @endif + @else + + {{ __('Make a purchase to reveal your referral-URL') }} + @endif
- - @if((config('SETTINGS::REFERRAL::ENABLED') ==true)) -
-
-

- - {{ __('Partner program') }} -

-
- -
- @if((config('SETTINGS::REFERRAL::ALLOWED') == "client" && Auth::user()->role != "member") || config('SETTINGS::REFERRAL::ALLOWED') == "everyone") -
-
- - - {{__("Your referral URL")}}: - - {{__('Click to copy')}} - - -
-
- {{__("Number of referred users:")}} {{$numberOfReferrals}} -
-
- @if($partnerDiscount) -
- - - - - - - - - - - - - - - - - -
{{__('Your discount')}}{{__('Discount for your new users')}}{{__('Reward per registered user')}}{{__('New user payment commision')}}
{{$partnerDiscount->partner_discount}}%{{$partnerDiscount->registered_user_discount}}%{{config('SETTINGS::REFERRAL::REWARD')}} {{config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME')}}{{($partnerDiscount->referral_system_commission==-1)?config('SETTINGS::REFERRAL:PERCENTAGE'):($partnerDiscount->referral_system_commission)}}%
-
- @else -
- - - - - - - - - - - - - -
{{__('Reward per registered user')}}{{__('New user payment commision')}}
{{config('SETTINGS::REFERRAL::REWARD')}} {{config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME')}}{{config('SETTINGS::REFERRAL:PERCENTAGE')}}%
-
- @endif - @else - - {{__("Make a purchase to reveal your referral-URL")}} - @endif -
- -
- @endif - -
- + @endif + +
+
@@ -276,24 +306,27 @@