Merge branch 'ControlPanel-gg:development' into development
This commit is contained in:
commit
701beefd54
|
@ -26,8 +26,8 @@ class CreditProductController extends Controller
|
||||||
|
|
||||||
if (
|
if (
|
||||||
env('APP_ENV') == 'local' ||
|
env('APP_ENV') == 'local' ||
|
||||||
Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") ||
|
config("SETTINGS::PAYMENTS:PAYPAL:SECRET") && config("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") ||
|
||||||
Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:METHODS")
|
config("SETTINGS::PAYMENTS:STRIPE:SECRET") && config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && config("SETTINGS::PAYMENTS:STRIPE:METHODS")
|
||||||
) $isPaymentSetup = true;
|
) $isPaymentSetup = true;
|
||||||
|
|
||||||
return view('admin.store.index', [
|
return view('admin.store.index', [
|
||||||
|
|
|
@ -134,7 +134,7 @@ class PaymentController extends Controller
|
||||||
*/
|
*/
|
||||||
protected function getPaypalClientId()
|
protected function getPaypalClientId()
|
||||||
{
|
{
|
||||||
return env('APP_ENV') == 'local' ? Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID") : Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID");
|
return env('APP_ENV') == 'local' ? config("SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID") : config("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -142,7 +142,7 @@ class PaymentController extends Controller
|
||||||
*/
|
*/
|
||||||
protected function getPaypalClientSecret()
|
protected function getPaypalClientSecret()
|
||||||
{
|
{
|
||||||
return env('APP_ENV') == 'local' ? Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET") : Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET");
|
return env('APP_ENV') == 'local' ? config("SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET") : config("SETTINGS::PAYMENTS:PAYPAL:SECRET");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,9 +167,9 @@ class PaymentController extends Controller
|
||||||
$user->increment('credits', $creditProduct->quantity);
|
$user->increment('credits', $creditProduct->quantity);
|
||||||
|
|
||||||
//update server limit
|
//update server limit
|
||||||
if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||||
if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
if ($user->server_limit < config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
||||||
$user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
$user->update(['server_limit' => config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,9 +308,9 @@ class PaymentController extends Controller
|
||||||
$user->increment('credits', $creditProduct->quantity);
|
$user->increment('credits', $creditProduct->quantity);
|
||||||
|
|
||||||
//update server limit
|
//update server limit
|
||||||
if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||||
if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
if ($user->server_limit < config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
||||||
$user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
$user->update(['server_limit' => config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,9 +408,9 @@ class PaymentController extends Controller
|
||||||
$user->increment('credits', $payment->amount);
|
$user->increment('credits', $payment->amount);
|
||||||
|
|
||||||
//update server limit
|
//update server limit
|
||||||
if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||||
if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
if ($user->server_limit < config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
||||||
$user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
$user->update(['server_limit' => config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,8 +487,8 @@ class PaymentController extends Controller
|
||||||
protected function getStripeSecret()
|
protected function getStripeSecret()
|
||||||
{
|
{
|
||||||
return env('APP_ENV') == 'local'
|
return env('APP_ENV') == 'local'
|
||||||
? Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:TEST_SECRET")
|
? config("SETTINGS::PAYMENTS:STRIPE:TEST_SECRET")
|
||||||
: Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:SECRET");
|
: config("SETTINGS::PAYMENTS:STRIPE:SECRET");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -497,8 +497,8 @@ class PaymentController extends Controller
|
||||||
protected function getStripeEndpointSecret()
|
protected function getStripeEndpointSecret()
|
||||||
{
|
{
|
||||||
return env('APP_ENV') == 'local'
|
return env('APP_ENV') == 'local'
|
||||||
? Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET")
|
? config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET")
|
||||||
: Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET");
|
: config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -511,13 +511,13 @@ class PaymentController extends Controller
|
||||||
$logoPath = storage_path('app/public/logo.png');
|
$logoPath = storage_path('app/public/logo.png');
|
||||||
|
|
||||||
$seller = new Party([
|
$seller = new Party([
|
||||||
'name' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_NAME"),
|
'name' => config("SETTINGS::INVOICE:COMPANY_NAME"),
|
||||||
'phone' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_PHONE"),
|
'phone' => config("SETTINGS::INVOICE:COMPANY_PHONE"),
|
||||||
'address' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_ADDRESS"),
|
'address' => config("SETTINGS::INVOICE:COMPANY_ADDRESS"),
|
||||||
'vat' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_VAT"),
|
'vat' => config("SETTINGS::INVOICE:COMPANY_VAT"),
|
||||||
'custom_fields' => [
|
'custom_fields' => [
|
||||||
'E-Mail' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_MAIL"),
|
'E-Mail' => config("SETTINGS::INVOICE:COMPANY_MAIL"),
|
||||||
"Web" => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_WEBSITE")
|
"Web" => config("SETTINGS::INVOICE:COMPANY_WEBSITE")
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ class PaymentController extends Controller
|
||||||
->series(now()->format('mY'))
|
->series(now()->format('mY'))
|
||||||
->delimiter("-")
|
->delimiter("-")
|
||||||
->sequence($newInvoiceID)
|
->sequence($newInvoiceID)
|
||||||
->serialNumberFormat(Settings::getValueByKey("SETTINGS::INVOICE:PREFIX") . '{DELIMITER}{SERIES}{SEQUENCE}')
|
->serialNumberFormat(config("SETTINGS::INVOICE:PREFIX") . '{DELIMITER}{SERIES}{SEQUENCE}')
|
||||||
->notes($notes);
|
->notes($notes);
|
||||||
|
|
||||||
if (file_exists($logoPath)) {
|
if (file_exists($logoPath)) {
|
||||||
|
|
|
@ -34,14 +34,15 @@ class ProductController extends Controller
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('admin.products.create' , [
|
return view('admin.products.create', [
|
||||||
'locations' => Location::with('nodes')->get(),
|
'locations' => Location::with('nodes')->get(),
|
||||||
'nests' => Nest::with('eggs')->get(),
|
'nests' => Nest::with('eggs')->get(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clone(Request $request , Product $product){
|
public function clone(Request $request, Product $product)
|
||||||
return view('admin.products.create' , [
|
{
|
||||||
|
return view('admin.products.create', [
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'locations' => Location::with('nodes')->get(),
|
'locations' => Location::with('nodes')->get(),
|
||||||
'nests' => Nest::with('eggs')->get(),
|
'nests' => Nest::with('eggs')->get(),
|
||||||
|
@ -94,7 +95,7 @@ class ProductController extends Controller
|
||||||
{
|
{
|
||||||
return view('admin.products.show', [
|
return view('admin.products.show', [
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'minimum_credits' => Settings::getValueByKey("SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER"),
|
'minimum_credits' => config("SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER"),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,14 +194,14 @@ class ProductController extends Controller
|
||||||
return datatables($query)
|
return datatables($query)
|
||||||
->addColumn('actions', function (Product $product) {
|
->addColumn('actions', function (Product $product) {
|
||||||
return '
|
return '
|
||||||
<a data-content="'.__("Show").'" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.show', $product->id) . '" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
|
<a data-content="' . __("Show") . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.show', $product->id) . '" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
|
||||||
<a data-content="'.__("Clone").'" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.clone', $product->id) . '" class="btn btn-sm text-white btn-primary mr-1"><i class="fas fa-clone"></i></a>
|
<a data-content="' . __("Clone") . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.clone', $product->id) . '" class="btn btn-sm text-white btn-primary mr-1"><i class="fas fa-clone"></i></a>
|
||||||
<a data-content="'.__("Edit").'" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.products.edit', $product->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.products.edit', $product->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.products.destroy', $product->id) . '">
|
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.products.destroy', $product->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>
|
||||||
';
|
';
|
||||||
})
|
})
|
||||||
|
|
|
@ -103,7 +103,8 @@ class ServerController extends Controller
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function toggleSuspended(Server $server){
|
public function toggleSuspended(Server $server)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
$server->isSuspended() ? $server->unSuspend() : $server->suspend();
|
$server->isSuspended() ? $server->unSuspend() : $server->suspend();
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
@ -140,13 +141,13 @@ class ServerController extends Controller
|
||||||
return '
|
return '
|
||||||
<form class="d-inline" method="post" action="' . route('admin.servers.togglesuspend', $server->id) . '">
|
<form class="d-inline" method="post" action="' . route('admin.servers.togglesuspend', $server->id) . '">
|
||||||
' . csrf_field() . '
|
' . csrf_field() . '
|
||||||
<button data-content="'.$suspendText.'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm '.$suspendColor.' text-white mr-1"><i class="far '.$suspendIcon.'"></i></button>
|
<button data-content="' . $suspendText . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm ' . $suspendColor . ' text-white mr-1"><i class="far ' . $suspendIcon . '"></i></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.servers.destroy', $server->id) . '">
|
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.servers.destroy', $server->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>
|
||||||
|
|
||||||
';
|
';
|
||||||
|
@ -162,7 +163,7 @@ class ServerController extends Controller
|
||||||
return $server->suspended ? $server->suspended->diffForHumans() : '';
|
return $server->suspended ? $server->suspended->diffForHumans() : '';
|
||||||
})
|
})
|
||||||
->editColumn('name', function (Server $server) {
|
->editColumn('name', function (Server $server) {
|
||||||
return '<a class="text-info" target="_blank" href="' . Settings::getValueByKey("SETTINGS::SYSTEM:PTERODACTYL:URL") . '/admin/servers/view/' . $server->pterodactyl_id . '">' . $server->name . '</a>';
|
return '<a class="text-info" target="_blank" href="' . config("SETTINGS::SYSTEM:PTERODACTYL:URL") . '/admin/servers/view/' . $server->pterodactyl_id . '">' . $server->name . '</a>';
|
||||||
})
|
})
|
||||||
->rawColumns(['user', 'actions', 'status', 'name'])
|
->rawColumns(['user', 'actions', 'status', 'name'])
|
||||||
->make();
|
->make();
|
||||||
|
|
|
@ -226,7 +226,8 @@ class UserController extends Controller
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @return RedirectResponse
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function toggleSuspended(User $user){
|
public function toggleSuspended(User $user)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
!$user->isSuspended() ? $user->suspend() : $user->unSuspend();
|
!$user->isSuspended() ? $user->suspend() : $user->unSuspend();
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
@ -268,17 +269,17 @@ class UserController extends Controller
|
||||||
$suspendIcon = $user->isSuspended() ? "fa-play-circle" : "fa-pause-circle";
|
$suspendIcon = $user->isSuspended() ? "fa-play-circle" : "fa-pause-circle";
|
||||||
$suspendText = $user->isSuspended() ? __("Unsuspend") : __("Suspend");
|
$suspendText = $user->isSuspended() ? __("Unsuspend") : __("Suspend");
|
||||||
return '
|
return '
|
||||||
<a data-content="'.__("Login as User").'" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.loginas', $user->id) . '" class="btn btn-sm btn-primary mr-1"><i class="fas fa-sign-in-alt"></i></a>
|
<a data-content="' . __("Login as User") . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.loginas', $user->id) . '" class="btn btn-sm btn-primary mr-1"><i class="fas fa-sign-in-alt"></i></a>
|
||||||
<a data-content="'.__("Show").'" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.show', $user->id) . '" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
|
<a data-content="' . __("Show") . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.show', $user->id) . '" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
|
||||||
<a data-content="'.__("Edit").'" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.edit', $user->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.users.edit', $user->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
|
||||||
<form class="d-inline" method="post" action="' . route('admin.users.togglesuspend', $user->id) . '">
|
<form class="d-inline" method="post" action="' . route('admin.users.togglesuspend', $user->id) . '">
|
||||||
' . csrf_field() . '
|
' . csrf_field() . '
|
||||||
<button data-content="'.$suspendText.'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm '.$suspendColor.' text-white mr-1"><i class="far '.$suspendIcon.'"></i></button>
|
<button data-content="' . $suspendText . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm ' . $suspendColor . ' text-white mr-1"><i class="far ' . $suspendIcon . '"></i></button>
|
||||||
</form>
|
</form>
|
||||||
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.users.destroy', $user->id) . '">
|
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.users.destroy', $user->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>
|
||||||
';
|
';
|
||||||
})
|
})
|
||||||
|
@ -301,7 +302,7 @@ class UserController extends Controller
|
||||||
return '<span class="badge ' . $badgeColor . '">' . $user->role . '</span>';
|
return '<span class="badge ' . $badgeColor . '">' . $user->role . '</span>';
|
||||||
})
|
})
|
||||||
->editColumn('name', function (User $user) {
|
->editColumn('name', function (User $user) {
|
||||||
return '<a class="text-info" target="_blank" href="' . Settings::getValueByKey("SETTINGS::SYSTEM:PTERODACTYL:URL") . '/admin/users/view/' . $user->pterodactyl_id . '">' . $user->name . '</a>';
|
return '<a class="text-info" target="_blank" href="' . config("SETTINGS::SYSTEM:PTERODACTYL:URL") . '/admin/users/view/' . $user->pterodactyl_id . '">' . $user->name . '</a>';
|
||||||
})
|
})
|
||||||
->orderColumn('last_seen', function ($query, $order) {
|
->orderColumn('last_seen', function ($query, $order) {
|
||||||
$query->orderBy('last_seen', $order);
|
$query->orderBy('last_seen', $order);
|
||||||
|
|
|
@ -92,7 +92,7 @@ class UserController extends Controller
|
||||||
|
|
||||||
//Update Users Password on Pterodactyl
|
//Update Users Password on Pterodactyl
|
||||||
//Username,Mail,First and Lastname are required aswell
|
//Username,Mail,First and Lastname are required aswell
|
||||||
$response = Pterodactyl::client()->patch('/application/users/'.$user->pterodactyl_id, [
|
$response = Pterodactyl::client()->patch('/application/users/' . $user->pterodactyl_id, [
|
||||||
"username" => $request->name,
|
"username" => $request->name,
|
||||||
"first_name" => $request->name,
|
"first_name" => $request->name,
|
||||||
"last_name" => $request->name,
|
"last_name" => $request->name,
|
||||||
|
@ -242,8 +242,8 @@ class UserController extends Controller
|
||||||
$user = User::create([
|
$user = User::create([
|
||||||
'name' => $request->input('name'),
|
'name' => $request->input('name'),
|
||||||
'email' => $request->input('email'),
|
'email' => $request->input('email'),
|
||||||
'credits' => Settings::getValueByKey('SETTINGS::USER:INITIAL_CREDITS', 150),
|
'credits' => config('SETTINGS::USER:INITIAL_CREDITS', 150),
|
||||||
'server_limit' => Settings::getValueByKey('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1),
|
'server_limit' => config('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1),
|
||||||
'password' => Hash::make($request->input('password')),
|
'password' => Hash::make($request->input('password')),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class SocialiteController extends Controller
|
||||||
{
|
{
|
||||||
public function redirect()
|
public function redirect()
|
||||||
{
|
{
|
||||||
$scopes = !empty(Settings::getValueByKey("SETTINGS::DISCORD:BOT_TOKEN")) && !empty(Settings::getValueByKey("SETTINGS::DISCORD:GUILD_ID")) ? ['guilds.join'] : [];
|
$scopes = !empty(config("SETTINGS::DISCORD:BOT_TOKEN")) && !empty(config("SETTINGS::DISCORD:GUILD_ID")) ? ['guilds.join'] : [];
|
||||||
|
|
||||||
return Socialite::driver('discord')
|
return Socialite::driver('discord')
|
||||||
->scopes($scopes)
|
->scopes($scopes)
|
||||||
|
@ -31,17 +31,17 @@ class SocialiteController extends Controller
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$discord = Socialite::driver('discord')->user();
|
$discord = Socialite::driver('discord')->user();
|
||||||
$botToken = Settings::getValueByKey("SETTINGS::DISCORD:BOT_TOKEN");
|
$botToken = config("SETTINGS::DISCORD:BOT_TOKEN");
|
||||||
$guildId = Settings::getValueByKey("SETTINGS::DISCORD:GUILD_ID");
|
$guildId = config("SETTINGS::DISCORD:GUILD_ID");
|
||||||
$roleId = Settings::getValueByKey("SETTINGS::DISCORD:ROLE_ID");
|
$roleId = config("SETTINGS::DISCORD:ROLE_ID");
|
||||||
|
|
||||||
//save / update discord_users
|
//save / update discord_users
|
||||||
if (is_null($user->discordUser)) {
|
if (is_null($user->discordUser)) {
|
||||||
//create discord user in db
|
//create discord user in db
|
||||||
DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id]));
|
DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id]));
|
||||||
//update user
|
//update user
|
||||||
Auth::user()->increment('credits', Settings::getValueByKey('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD'));
|
Auth::user()->increment('credits', config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD'));
|
||||||
Auth::user()->increment('server_limit', Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD'));
|
Auth::user()->increment('server_limit', config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD'));
|
||||||
Auth::user()->update(['discord_verified_at' => now()]);
|
Auth::user()->update(['discord_verified_at' => now()]);
|
||||||
} else {
|
} else {
|
||||||
$user->discordUser->update($discord->user);
|
$user->discordUser->update($discord->user);
|
||||||
|
@ -55,18 +55,22 @@ class SocialiteController extends Controller
|
||||||
'Authorization' => 'Bot ' . $botToken,
|
'Authorization' => 'Bot ' . $botToken,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
]
|
]
|
||||||
)->put("https://discord.com/api/guilds/{$guildId}/members/{$discord->id}",
|
)->put(
|
||||||
['access_token' => $discord->token]);
|
"https://discord.com/api/guilds/{$guildId}/members/{$discord->id}",
|
||||||
|
['access_token' => $discord->token]
|
||||||
|
);
|
||||||
|
|
||||||
//give user a role in the discord server
|
//give user a role in the discord server
|
||||||
if (!empty($roleId)){
|
if (!empty($roleId)) {
|
||||||
$response = Http::withHeaders(
|
$response = Http::withHeaders(
|
||||||
[
|
[
|
||||||
'Authorization' => 'Bot ' . $botToken,
|
'Authorization' => 'Bot ' . $botToken,
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
]
|
]
|
||||||
)->put("https://discord.com/api/guilds/{$guildId}/members/{$discord->id}/roles/{$roleId}",
|
)->put(
|
||||||
['access_token' => $discord->token]);
|
"https://discord.com/api/guilds/{$guildId}/members/{$discord->id}/roles/{$roleId}",
|
||||||
|
['access_token' => $discord->token]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,17 +15,17 @@ class StoreController extends Controller
|
||||||
|
|
||||||
if (
|
if (
|
||||||
env('APP_ENV') == 'local' ||
|
env('APP_ENV') == 'local' ||
|
||||||
Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") ||
|
config("SETTINGS::PAYMENTS:PAYPAL:SECRET") && config("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") ||
|
||||||
Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:METHODS")
|
config("SETTINGS::PAYMENTS:STRIPE:SECRET") && config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && config("SETTINGS::PAYMENTS:STRIPE:METHODS")
|
||||||
) $isPaymentSetup = true;
|
) $isPaymentSetup = true;
|
||||||
|
|
||||||
//Required Verification for creating an server
|
//Required Verification for creating an server
|
||||||
if (Settings::getValueByKey('SETTINGS::USER:FORCE_EMAIL_VERIFICATION', false) === 'true' && !Auth::user()->hasVerifiedEmail()) {
|
if (config('SETTINGS::USER:FORCE_EMAIL_VERIFICATION', false) === 'true' && !Auth::user()->hasVerifiedEmail()) {
|
||||||
return redirect()->route('profile.index')->with('error', __("You are required to verify your email address before you can purchase credits."));
|
return redirect()->route('profile.index')->with('error', __("You are required to verify your email address before you can purchase credits."));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Required Verification for creating an server
|
//Required Verification for creating an server
|
||||||
if (Settings::getValueByKey('SETTINGS::USER:FORCE_DISCORD_VERIFICATION', false) === 'true' && !Auth::user()->discordUser) {
|
if (config('SETTINGS::USER:FORCE_DISCORD_VERIFICATION', false) === 'true' && !Auth::user()->discordUser) {
|
||||||
return redirect()->route('profile.index')->with('error', __("You are required to link your discord account before you can purchase Credits"));
|
return redirect()->route('profile.index')->with('error', __("You are required to link your discord account before you can purchase Credits"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ class UnsuspendServers implements ShouldQueue
|
||||||
*/
|
*/
|
||||||
public function handle(UserUpdateCreditsEvent $event)
|
public function handle(UserUpdateCreditsEvent $event)
|
||||||
{
|
{
|
||||||
if ($event->user->credits > Settings::getValueByKey('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)){
|
if ($event->user->credits > config('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', 50)) {
|
||||||
/** @var Server $server */
|
/** @var Server $server */
|
||||||
foreach ($event->user->servers as $server){
|
foreach ($event->user->servers as $server) {
|
||||||
if ($server->isSuspended()) $server->unSuspend();
|
if ($server->isSuspended()) $server->unSuspend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Verified
|
||||||
*/
|
*/
|
||||||
public function handle($event)
|
public function handle($event)
|
||||||
{
|
{
|
||||||
$event->user->increment('server_limit' , Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL'));
|
$event->user->increment('server_limit', config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL'));
|
||||||
$event->user->increment('credits' , Settings::getValueByKey('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL'));
|
$event->user->increment('credits', config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class CreditProduct extends Model
|
||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function formatToCurrency($value,$locale = 'en_US')
|
public function formatToCurrency($value, $locale = 'en_US')
|
||||||
{
|
{
|
||||||
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
||||||
return $formatter->formatCurrency($value, $this->currency_code);
|
return $formatter->formatCurrency($value, $this->currency_code);
|
||||||
|
@ -59,7 +59,7 @@ class CreditProduct extends Model
|
||||||
*/
|
*/
|
||||||
public function getTaxPercent()
|
public function getTaxPercent()
|
||||||
{
|
{
|
||||||
$tax = Settings::getValueByKey("SETTINGS::PAYMENTS:SALES_TAX");
|
$tax = config("SETTINGS::PAYMENTS:SALES_TAX");
|
||||||
return $tax < 0 ? 0 : $tax;
|
return $tax < 0 ? 0 : $tax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class CreditProduct extends Model
|
||||||
*/
|
*/
|
||||||
public function getTaxValue()
|
public function getTaxValue()
|
||||||
{
|
{
|
||||||
return number_format($this->price*$this->getTaxPercent()/100,2);
|
return number_format($this->price * $this->getTaxPercent() / 100, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,6 +80,6 @@ class CreditProduct extends Model
|
||||||
*/
|
*/
|
||||||
public function getTotalPrice()
|
public function getTotalPrice()
|
||||||
{
|
{
|
||||||
return number_format($this->price+$this->getTaxValue(),2);
|
return number_format($this->price + $this->getTaxValue(), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue