fix: ✨ replaced Settings::getValueByKey with config()
This commit is contained in:
parent
51ff4e9bb0
commit
128b10bbb1
11 changed files with 95 additions and 88 deletions
|
@ -26,8 +26,8 @@ class CreditProductController extends Controller
|
|||
|
||||
if (
|
||||
env('APP_ENV') == 'local' ||
|
||||
Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET") && Settings::getValueByKey("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:PAYPAL:SECRET") && config("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") ||
|
||||
config("SETTINGS::PAYMENTS:STRIPE:SECRET") && config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && config("SETTINGS::PAYMENTS:STRIPE:METHODS")
|
||||
) $isPaymentSetup = true;
|
||||
|
||||
return view('admin.store.index', [
|
||||
|
|
|
@ -134,7 +134,7 @@ class PaymentController extends Controller
|
|||
*/
|
||||
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()
|
||||
{
|
||||
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);
|
||||
|
||||
//update server limit
|
||||
if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||
if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
||||
$user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
||||
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||
if ($user->server_limit < config('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);
|
||||
|
||||
//update server limit
|
||||
if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||
if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
||||
$user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
||||
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||
if ($user->server_limit < config('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);
|
||||
|
||||
//update server limit
|
||||
if (Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||
if ($user->server_limit < Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')) {
|
||||
$user->update(['server_limit' => Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE')]);
|
||||
if (config('SETTINGS::USER:SERVER_LIMIT_AFTER_IRL_PURCHASE') !== 0) {
|
||||
if ($user->server_limit < config('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()
|
||||
{
|
||||
return env('APP_ENV') == 'local'
|
||||
? Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:TEST_SECRET")
|
||||
: Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:SECRET");
|
||||
? config("SETTINGS::PAYMENTS:STRIPE:TEST_SECRET")
|
||||
: config("SETTINGS::PAYMENTS:STRIPE:SECRET");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -497,8 +497,8 @@ class PaymentController extends Controller
|
|||
protected function getStripeEndpointSecret()
|
||||
{
|
||||
return env('APP_ENV') == 'local'
|
||||
? Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET")
|
||||
: Settings::getValueByKey("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET");
|
||||
? config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET")
|
||||
: config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET");
|
||||
}
|
||||
|
||||
|
||||
|
@ -511,13 +511,13 @@ class PaymentController extends Controller
|
|||
$logoPath = storage_path('app/public/logo.png');
|
||||
|
||||
$seller = new Party([
|
||||
'name' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_NAME"),
|
||||
'phone' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_PHONE"),
|
||||
'address' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_ADDRESS"),
|
||||
'vat' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_VAT"),
|
||||
'name' => config("SETTINGS::INVOICE:COMPANY_NAME"),
|
||||
'phone' => config("SETTINGS::INVOICE:COMPANY_PHONE"),
|
||||
'address' => config("SETTINGS::INVOICE:COMPANY_ADDRESS"),
|
||||
'vat' => config("SETTINGS::INVOICE:COMPANY_VAT"),
|
||||
'custom_fields' => [
|
||||
'E-Mail' => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_MAIL"),
|
||||
"Web" => Settings::getValueByKey("SETTINGS::INVOICE:COMPANY_WEBSITE")
|
||||
'E-Mail' => config("SETTINGS::INVOICE:COMPANY_MAIL"),
|
||||
"Web" => config("SETTINGS::INVOICE:COMPANY_WEBSITE")
|
||||
],
|
||||
]);
|
||||
|
||||
|
@ -552,7 +552,7 @@ class PaymentController extends Controller
|
|||
->series(now()->format('mY'))
|
||||
->delimiter("-")
|
||||
->sequence($newInvoiceID)
|
||||
->serialNumberFormat(Settings::getValueByKey("SETTINGS::INVOICE:PREFIX") . '{DELIMITER}{SERIES}{SEQUENCE}')
|
||||
->serialNumberFormat(config("SETTINGS::INVOICE:PREFIX") . '{DELIMITER}{SERIES}{SEQUENCE}')
|
||||
->notes($notes);
|
||||
|
||||
if (file_exists($logoPath)) {
|
||||
|
|
|
@ -34,14 +34,15 @@ class ProductController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.products.create' , [
|
||||
return view('admin.products.create', [
|
||||
'locations' => Location::with('nodes')->get(),
|
||||
'nests' => Nest::with('eggs')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function clone(Request $request , Product $product){
|
||||
return view('admin.products.create' , [
|
||||
public function clone(Request $request, Product $product)
|
||||
{
|
||||
return view('admin.products.create', [
|
||||
'product' => $product,
|
||||
'locations' => Location::with('nodes')->get(),
|
||||
'nests' => Nest::with('eggs')->get(),
|
||||
|
@ -94,7 +95,7 @@ class ProductController extends Controller
|
|||
{
|
||||
return view('admin.products.show', [
|
||||
'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)
|
||||
->addColumn('actions', function (Product $product) {
|
||||
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="'.__("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="' . __("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="' . __("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) . '">
|
||||
' . 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>
|
||||
<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>
|
||||
';
|
||||
})
|
||||
|
|
|
@ -103,7 +103,8 @@ class ServerController extends Controller
|
|||
* @param Server $server
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function toggleSuspended(Server $server){
|
||||
public function toggleSuspended(Server $server)
|
||||
{
|
||||
try {
|
||||
$server->isSuspended() ? $server->unSuspend() : $server->suspend();
|
||||
} catch (Exception $exception) {
|
||||
|
@ -140,13 +141,13 @@ class ServerController extends Controller
|
|||
return '
|
||||
<form class="d-inline" method="post" action="' . route('admin.servers.togglesuspend', $server->id) . '">
|
||||
' . 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 class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.servers.destroy', $server->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>
|
||||
<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>
|
||||
|
||||
';
|
||||
|
@ -162,7 +163,7 @@ class ServerController extends Controller
|
|||
return $server->suspended ? $server->suspended->diffForHumans() : '';
|
||||
})
|
||||
->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'])
|
||||
->make();
|
||||
|
|
|
@ -226,7 +226,8 @@ class UserController extends Controller
|
|||
* @param User $user
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function toggleSuspended(User $user){
|
||||
public function toggleSuspended(User $user)
|
||||
{
|
||||
try {
|
||||
!$user->isSuspended() ? $user->suspend() : $user->unSuspend();
|
||||
} catch (Exception $exception) {
|
||||
|
@ -268,17 +269,17 @@ class UserController extends Controller
|
|||
$suspendIcon = $user->isSuspended() ? "fa-play-circle" : "fa-pause-circle";
|
||||
$suspendText = $user->isSuspended() ? __("Unsuspend") : __("Suspend");
|
||||
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="'.__("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="' . __("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="' . __("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) . '">
|
||||
' . 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 class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.users.destroy', $user->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>
|
||||
<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>
|
||||
';
|
||||
})
|
||||
|
@ -301,7 +302,7 @@ class UserController extends Controller
|
|||
return '<span class="badge ' . $badgeColor . '">' . $user->role . '</span>';
|
||||
})
|
||||
->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) {
|
||||
$query->orderBy('last_seen', $order);
|
||||
|
|
|
@ -92,7 +92,7 @@ class UserController extends Controller
|
|||
|
||||
//Update Users Password on Pterodactyl
|
||||
//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,
|
||||
"first_name" => $request->name,
|
||||
"last_name" => $request->name,
|
||||
|
@ -195,9 +195,9 @@ class UserController extends Controller
|
|||
$user = $discordUser ? $discordUser->user : User::findOrFail($id);
|
||||
|
||||
if ($user->isSuspended()) {
|
||||
throw ValidationException::withMessages([
|
||||
'error' => 'The user is already suspended',
|
||||
]);
|
||||
throw ValidationException::withMessages([
|
||||
'error' => 'The user is already suspended',
|
||||
]);
|
||||
}
|
||||
$user->suspend();
|
||||
|
||||
|
@ -242,8 +242,8 @@ class UserController extends Controller
|
|||
$user = User::create([
|
||||
'name' => $request->input('name'),
|
||||
'email' => $request->input('email'),
|
||||
'credits' => Settings::getValueByKey('SETTINGS::USER:INITIAL_CREDITS', 150),
|
||||
'server_limit' => Settings::getValueByKey('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1),
|
||||
'credits' => config('SETTINGS::USER:INITIAL_CREDITS', 150),
|
||||
'server_limit' => config('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1),
|
||||
'password' => Hash::make($request->input('password')),
|
||||
]);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ class SocialiteController extends Controller
|
|||
{
|
||||
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')
|
||||
->scopes($scopes)
|
||||
|
@ -31,17 +31,17 @@ class SocialiteController extends Controller
|
|||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
$discord = Socialite::driver('discord')->user();
|
||||
$botToken = Settings::getValueByKey("SETTINGS::DISCORD:BOT_TOKEN");
|
||||
$guildId = Settings::getValueByKey("SETTINGS::DISCORD:GUILD_ID");
|
||||
$roleId = Settings::getValueByKey("SETTINGS::DISCORD:ROLE_ID");
|
||||
$botToken = config("SETTINGS::DISCORD:BOT_TOKEN");
|
||||
$guildId = config("SETTINGS::DISCORD:GUILD_ID");
|
||||
$roleId = config("SETTINGS::DISCORD:ROLE_ID");
|
||||
|
||||
//save / update discord_users
|
||||
if (is_null($user->discordUser)) {
|
||||
//create discord user in db
|
||||
DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id]));
|
||||
//update user
|
||||
Auth::user()->increment('credits', Settings::getValueByKey('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('credits', config('SETTINGS::USER:CREDITS_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()]);
|
||||
} else {
|
||||
$user->discordUser->update($discord->user);
|
||||
|
@ -55,18 +55,22 @@ class SocialiteController extends Controller
|
|||
'Authorization' => 'Bot ' . $botToken,
|
||||
'Content-Type' => 'application/json',
|
||||
]
|
||||
)->put("https://discord.com/api/guilds/{$guildId}/members/{$discord->id}",
|
||||
['access_token' => $discord->token]);
|
||||
)->put(
|
||||
"https://discord.com/api/guilds/{$guildId}/members/{$discord->id}",
|
||||
['access_token' => $discord->token]
|
||||
);
|
||||
|
||||
//give user a role in the discord server
|
||||
if (!empty($roleId)){
|
||||
if (!empty($roleId)) {
|
||||
$response = Http::withHeaders(
|
||||
[
|
||||
'Authorization' => 'Bot ' . $botToken,
|
||||
'Content-Type' => 'application/json',
|
||||
]
|
||||
)->put("https://discord.com/api/guilds/{$guildId}/members/{$discord->id}/roles/{$roleId}",
|
||||
['access_token' => $discord->token]);
|
||||
)->put(
|
||||
"https://discord.com/api/guilds/{$guildId}/members/{$discord->id}/roles/{$roleId}",
|
||||
['access_token' => $discord->token]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,17 +15,17 @@ class StoreController extends Controller
|
|||
|
||||
if (
|
||||
env('APP_ENV') == 'local' ||
|
||||
Settings::getValueByKey("SETTINGS::PAYMENTS:PAYPAL:SECRET") && Settings::getValueByKey("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:PAYPAL:SECRET") && config("SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID") ||
|
||||
config("SETTINGS::PAYMENTS:STRIPE:SECRET") && config("SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET") && config("SETTINGS::PAYMENTS:STRIPE:METHODS")
|
||||
) $isPaymentSetup = true;
|
||||
|
||||
//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."));
|
||||
}
|
||||
|
||||
//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"));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ class UnsuspendServers implements ShouldQueue
|
|||
*/
|
||||
public function handle(UserUpdateCreditsEvent $event)
|
||||
{
|
||||
if ($event->user->credits > Settings::getValueByKey('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER' , 50)){
|
||||
/** @var Server $server */
|
||||
foreach ($event->user->servers as $server){
|
||||
if ($server->isSuspended()) $server->unSuspend();
|
||||
}
|
||||
}
|
||||
if ($event->user->credits > config('SETTINGS::USER:MINIMUM_REQUIRED_CREDITS_TO_MAKE_SERVER', 50)) {
|
||||
/** @var Server $server */
|
||||
foreach ($event->user->servers as $server) {
|
||||
if ($server->isSuspended()) $server->unSuspend();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class Verified
|
|||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
$event->user->increment('server_limit' , Settings::getValueByKey('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL'));
|
||||
$event->user->increment('credits' , Settings::getValueByKey('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL'));
|
||||
$event->user->increment('server_limit', config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL'));
|
||||
$event->user->increment('credits', config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,40 +46,40 @@ class CreditProduct extends Model
|
|||
*
|
||||
* @return float
|
||||
*/
|
||||
public function formatToCurrency($value,$locale = 'en_US')
|
||||
public function formatToCurrency($value, $locale = 'en_US')
|
||||
{
|
||||
$formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
|
||||
return $formatter->formatCurrency($value, $this->currency_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the tax in % taken from the Configuration
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
* @description Returns the tax in % taken from the Configuration
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTaxPercent()
|
||||
{
|
||||
$tax = Settings::getValueByKey("SETTINGS::PAYMENTS:SALES_TAX");
|
||||
$tax = config("SETTINGS::PAYMENTS:SALES_TAX");
|
||||
return $tax < 0 ? 0 : $tax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the tax as Number
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
* @description Returns the tax as Number
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getTaxValue()
|
||||
{
|
||||
return number_format($this->price*$this->getTaxPercent()/100,2);
|
||||
return number_format($this->price * $this->getTaxPercent() / 100, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns the full price of a Product including tax
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
* @description Returns the full price of a Product including tax
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
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