2021-06-05 09:26:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2022-05-30 09:07:10 +00:00
|
|
|
use App\Models\ShopProduct;
|
2021-06-26 20:04:23 +00:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2021-06-05 09:26:32 +00:00
|
|
|
|
|
|
|
class StoreController extends Controller
|
|
|
|
{
|
2021-06-06 18:17:52 +00:00
|
|
|
/** Display a listing of the resource. */
|
2021-06-06 21:26:36 +00:00
|
|
|
public function index()
|
2021-06-05 09:26:32 +00:00
|
|
|
{
|
2021-12-20 17:50:18 +00:00
|
|
|
$isPaymentSetup = false;
|
2021-06-26 20:04:23 +00:00
|
|
|
|
2021-12-20 17:50:18 +00:00
|
|
|
if (
|
|
|
|
env('APP_ENV') == 'local' ||
|
2023-01-05 17:01:42 +00:00
|
|
|
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;
|
|
|
|
}
|
2021-06-26 20:04:23 +00:00
|
|
|
|
|
|
|
//Required Verification for creating an server
|
2023-01-05 17:01:42 +00:00
|
|
|
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.'));
|
2021-06-26 20:04:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Required Verification for creating an server
|
2023-01-05 17:01:42 +00:00
|
|
|
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'));
|
2021-06-26 20:04:23 +00:00
|
|
|
}
|
2021-06-05 09:26:32 +00:00
|
|
|
|
|
|
|
return view('store.index')->with([
|
2022-05-30 09:07:10 +00:00
|
|
|
'products' => ShopProduct::where('disabled', '=', false)->orderBy('type', 'asc')->orderBy('price', 'asc')->get(),
|
2021-12-20 17:50:18 +00:00
|
|
|
'isPaymentSetup' => $isPaymentSetup,
|
2021-06-05 09:26:32 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|