commit
597d283779
|
@ -2,6 +2,7 @@
|
|||
|
||||
- PayPal Integration
|
||||
- Stripe Integration
|
||||
- Referral System
|
||||
- Email Verification
|
||||
- Audit Log
|
||||
- Admin Dashboard
|
||||
|
|
|
@ -37,6 +37,11 @@ class Misc
|
|||
'mailencryption' => 'nullable|string',
|
||||
'mailfromadress' => 'nullable|string',
|
||||
'mailfromname' => 'nullable|string',
|
||||
'enable_referral' => 'nullable|string',
|
||||
'referral_reward' => 'nullable|numeric',
|
||||
'referral_allowed' => 'nullable|string',
|
||||
'referral_percentage' => 'nullable|numeric',
|
||||
'referral_mode' => 'nullable|string',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
@ -69,6 +74,12 @@ class Misc
|
|||
"SETTINGS::MAIL:ENCRYPTION" => "mailencryption",
|
||||
"SETTINGS::MAIL:FROM_ADDRESS" => "mailfromadress",
|
||||
"SETTINGS::MAIL:FROM_NAME" => "mailfromname",
|
||||
"SETTINGS::REFERRAL::ENABLED" => "enable_referral",
|
||||
"SETTINGS::REFERRAL::REWARD" => "referral_reward",
|
||||
"SETTINGS::REFERRAL::ALLOWED" => "referral_allowed",
|
||||
"SETTINGS::REFERRAL:MODE" => "referral_mode",
|
||||
"SETTINGS::REFERRAL:PERCENTAGE" => "referral_percentage"
|
||||
|
||||
|
||||
];
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ use Illuminate\Http\JsonResponse;
|
|||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use LaravelDaily\Invoices\Classes\Buyer;
|
||||
use LaravelDaily\Invoices\Classes\InvoiceItem;
|
||||
|
@ -179,9 +181,25 @@ class PaymentController extends Controller
|
|||
}
|
||||
|
||||
|
||||
//update role
|
||||
//update role give Referral-reward
|
||||
if ($user->role == 'member') {
|
||||
$user->update(['role' => 'client']);
|
||||
|
||||
if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE") == "both") && $shopProduct->type=="Credits"){
|
||||
if($ref_user = DB::table("user_referrals")->where('registered_user_id', '=', $user->id)->first()){
|
||||
$ref_user = User::findOrFail($ref_user->referral_id);
|
||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||
$ref_user->increment('credits', $increment);
|
||||
|
||||
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||
activity()
|
||||
->performedOn($user)
|
||||
->causedBy($ref_user)
|
||||
->log('gained '. $increment.' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for commission-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//store payment
|
||||
|
@ -326,9 +344,25 @@ class PaymentController extends Controller
|
|||
$user->increment('server_limit', $shopProduct->quantity);
|
||||
}
|
||||
|
||||
//update role
|
||||
//update role give Referral-reward
|
||||
if ($user->role == 'member') {
|
||||
$user->update(['role' => 'client']);
|
||||
|
||||
if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE") == "both") && $shopProduct->type=="Credits"){
|
||||
if($ref_user = DB::table("user_referrals")->where('registered_user_id', '=', $user->id)->first()){
|
||||
$ref_user = User::findOrFail($ref_user->referral_id);
|
||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||
$ref_user->increment('credits', $increment);
|
||||
|
||||
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||
activity()
|
||||
->performedOn($user)
|
||||
->causedBy($ref_user)
|
||||
->log('gained '. $increment.' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for commission-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//store paid payment
|
||||
|
@ -431,9 +465,25 @@ class PaymentController extends Controller
|
|||
$user->increment('server_limit', $shopProduct->quantity);
|
||||
}
|
||||
|
||||
//update role
|
||||
//update role give Referral-reward
|
||||
if ($user->role == 'member') {
|
||||
$user->update(['role' => 'client']);
|
||||
|
||||
if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE") == "both")&& $shopProduct->type=="Credits"){
|
||||
if($ref_user = DB::table("user_referrals")->where('registered_user_id', '=', $user->id)->first()){
|
||||
$ref_user = User::findOrFail($ref_user->referral_id);
|
||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||
$ref_user->increment('credits', $increment);
|
||||
|
||||
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||
activity()
|
||||
->performedOn($user)
|
||||
->causedBy($ref_user)
|
||||
->log('gained '. $increment.' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for commission-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//update payment db entry status
|
||||
|
|
|
@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
|||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use App\Notifications\DynamicNotification;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Spatie\QueryBuilder\QueryBuilder;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
@ -52,8 +53,18 @@ class UserController extends Controller
|
|||
*/
|
||||
public function show(User $user)
|
||||
{
|
||||
//QUERY ALL REFERRALS A USER HAS
|
||||
//i am not proud of this at all.
|
||||
$allReferals = array();
|
||||
$referrals = DB::table("user_referrals")->where("referral_id","=",$user->id)->get();
|
||||
foreach($referrals as $referral){
|
||||
array_push($allReferals, $allReferals["id"] = User::query()->findOrFail($referral->registered_user_id));
|
||||
}
|
||||
array_pop($allReferals);
|
||||
|
||||
return view('admin.users.show')->with([
|
||||
'user' => $user
|
||||
'user' => $user,
|
||||
'referrals' => $allReferals
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -258,6 +269,9 @@ class UserController extends Controller
|
|||
->addColumn('servers', function (User $user) {
|
||||
return $user->servers->count();
|
||||
})
|
||||
->addColumn('referrals', function (User $user) {
|
||||
return DB::table('user_referrals')->where("referral_id","=",$user->id)->count();
|
||||
})
|
||||
->addColumn('discordId', function (User $user) {
|
||||
return $user->discordUser ? $user->discordUser->id : '';
|
||||
})
|
||||
|
@ -307,7 +321,7 @@ class UserController extends Controller
|
|||
->orderColumn('last_seen', function ($query) {
|
||||
$query->orderBy('last_seen', "desc");
|
||||
})
|
||||
->rawColumns(['avatar', 'name', 'credits', 'role', 'usage', 'actions', 'last_seen'])
|
||||
->rawColumns(['avatar', 'name', 'credits', 'role', 'usage', 'referrals', 'actions', 'last_seen'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ use App\Http\Controllers\Controller;
|
|||
use App\Models\DiscordUser;
|
||||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ReferralNotification;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
|
@ -17,6 +19,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
@ -227,7 +230,17 @@ class UserController extends Controller
|
|||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a unique Referral Code for User
|
||||
* @return string
|
||||
*/
|
||||
protected function createReferralCode(){
|
||||
$referralcode = STR::random(8);
|
||||
if (User::where('referral_code', '=', $referralcode)->exists()) {
|
||||
$this->createReferralCode();
|
||||
}
|
||||
return $referralcode;
|
||||
}
|
||||
/**
|
||||
* @throws ValidationException
|
||||
*/
|
||||
|
@ -245,6 +258,7 @@ class UserController extends Controller
|
|||
'credits' => config('SETTINGS::USER:INITIAL_CREDITS', 150),
|
||||
'server_limit' => config('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1),
|
||||
'password' => Hash::make($request->input('password')),
|
||||
'referral_code' => $this->createReferralCode(),
|
||||
]);
|
||||
|
||||
$response = Pterodactyl::client()->post('/application/users', [
|
||||
|
@ -269,7 +283,25 @@ class UserController extends Controller
|
|||
$user->update([
|
||||
'pterodactyl_id' => $response->json()['attributes']['id']
|
||||
]);
|
||||
//INCREMENT REFERRAL-USER CREDITS
|
||||
if(!empty($request->input("referral_code"))){
|
||||
$ref_code = $request->input("referral_code");
|
||||
$new_user = $user->id;
|
||||
if($ref_user = User::query()->where('referral_code', '=', $ref_code)->first()) {
|
||||
if(config("SETTINGS::REFERRAL:MODE") == "register" || config("SETTINGS::REFERRAL:MODE") == "both") {
|
||||
$ref_user->increment('credits', config("SETTINGS::REFERRAL::REWARD"));
|
||||
$ref_user->notify(new ReferralNotification($ref_user->id, $new_user));
|
||||
}
|
||||
//INSERT INTO USER_REFERRALS TABLE
|
||||
DB::table('user_referrals')->insert([
|
||||
'referral_id' => $ref_user->id,
|
||||
'registered_user_id' => $user->id,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
$user->sendEmailVerificationNotification();
|
||||
|
||||
return $user;
|
||||
|
|
|
@ -6,10 +6,15 @@ use App\Classes\Pterodactyl;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ReferralNotification;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
@ -78,6 +83,18 @@ class RegisterController extends Controller
|
|||
return Validator::make($data, $validationRules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a unique Referral Code for User
|
||||
* @return string
|
||||
*/
|
||||
protected function createReferralCode(){
|
||||
$referralcode = STR::random(8);
|
||||
if (User::where('referral_code', '=', $referralcode)->exists()) {
|
||||
$this->createReferralCode();
|
||||
}
|
||||
return $referralcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
|
@ -92,6 +109,8 @@ class RegisterController extends Controller
|
|||
'credits' => config('SETTINGS::USER:INITIAL_CREDITS', 150),
|
||||
'server_limit' => config('SETTINGS::USER:INITIAL_SERVER_LIMIT', 1),
|
||||
'password' => Hash::make($data['password']),
|
||||
'referral_code' => $this->createReferralCode(),
|
||||
|
||||
]);
|
||||
|
||||
$response = Pterodactyl::client()->post('/application/users', [
|
||||
|
@ -116,7 +135,31 @@ class RegisterController extends Controller
|
|||
'pterodactyl_id' => $response->json()['attributes']['id']
|
||||
]);
|
||||
|
||||
//INCREMENT REFERRAL-USER CREDITS
|
||||
if(!empty($data['referral_code'])){
|
||||
$ref_code = $data['referral_code'];
|
||||
$new_user = $user->id;
|
||||
if($ref_user = User::query()->where('referral_code', '=', $ref_code)->first()) {
|
||||
if(config("SETTINGS::REFERRAL:MODE") == "sign-up" || config("SETTINGS::REFERRAL:MODE") == "both") {
|
||||
$ref_user->increment('credits', config("SETTINGS::REFERRAL::REWARD"));
|
||||
$ref_user->notify(new ReferralNotification($ref_user->id, $new_user));
|
||||
|
||||
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||
activity()
|
||||
->performedOn($user)
|
||||
->causedBy($ref_user)
|
||||
->log('gained '. config("SETTINGS::REFERRAL::REWARD").' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for sign-up-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||
}
|
||||
//INSERT INTO USER_REFERRALS TABLE
|
||||
DB::table('user_referrals')->insert([
|
||||
'referral_id' => $ref_user->id,
|
||||
'registered_user_id' => $user->id,
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Models\DiscordUser;
|
|||
use App\Models\Settings;
|
||||
use App\Models\User;
|
||||
use App\Models\Voucher;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
|
@ -36,13 +37,25 @@ class SocialiteController extends Controller
|
|||
$roleId = config("SETTINGS::DISCORD:ROLE_ID");
|
||||
|
||||
//save / update discord_users
|
||||
|
||||
//check if discord account is already linked to an cpgg account
|
||||
if (is_null($user->discordUser)) {
|
||||
$discordLinked = DiscordUser::where('id', '=', $discord->id)->first();
|
||||
if ($discordLinked !== null) {
|
||||
return redirect()->route('profile.index')->with(
|
||||
'error',
|
||||
'Discord account already linked!'
|
||||
);
|
||||
}
|
||||
|
||||
//create discord user in db
|
||||
DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id]));
|
||||
|
||||
//update user
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class NotificationController extends Controller
|
||||
|
@ -15,7 +10,6 @@ class NotificationController extends Controller
|
|||
public function index()
|
||||
{
|
||||
$notifications = Auth::user()->notifications()->paginate();
|
||||
|
||||
return view('notifications.index')->with([
|
||||
'notifications' => $notifications
|
||||
]);
|
||||
|
@ -31,4 +25,13 @@ class NotificationController extends Controller
|
|||
'notification' => $notification
|
||||
]);
|
||||
}
|
||||
|
||||
public function readAll(){
|
||||
$notifications = Auth::user()->notifications()->get();
|
||||
foreach($notifications as $notification){
|
||||
$notification->markAsRead();
|
||||
}
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,26 @@ class ProfileController extends Controller
|
|||
/** Display a listing of the resource. */
|
||||
public function index()
|
||||
{
|
||||
switch (Auth::user()->role) {
|
||||
case 'admin':
|
||||
$badgeColor = 'badge-danger';
|
||||
break;
|
||||
case 'mod':
|
||||
$badgeColor = 'badge-info';
|
||||
break;
|
||||
case 'client':
|
||||
$badgeColor = 'badge-success';
|
||||
break;
|
||||
default:
|
||||
$badgeColor = 'badge-secondary';
|
||||
break;
|
||||
}
|
||||
return view('profile.index')->with([
|
||||
'user' => Auth::user(),
|
||||
'credits_reward_after_verify_discord' => config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD'),
|
||||
'force_email_verification' => config('SETTINGS::USER:FORCE_EMAIL_VERIFICATION'),
|
||||
'force_discord_verification' => config('SETTINGS::USER:FORCE_DISCORD_VERIFICATION'),
|
||||
'badgeColor' => $badgeColor,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||
'pterodactyl_id',
|
||||
'discord_verified_at',
|
||||
'avatar',
|
||||
'suspended'
|
||||
'suspended',
|
||||
'referral_code'
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -195,7 +196,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||
*/
|
||||
public function unSuspend()
|
||||
{
|
||||
foreach ($this->servers as $server) {
|
||||
foreach ($this->getServersWithProduct() as $server) {
|
||||
if ($this->credits >= $server->product->getHourlyPrice()) {
|
||||
$server->unSuspend();
|
||||
}
|
||||
|
@ -234,14 +235,19 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||
public function creditUsage()
|
||||
{
|
||||
$usage = 0;
|
||||
|
||||
foreach ($this->Servers as $server) {
|
||||
foreach ($this->getServersWithProduct() as $server) {
|
||||
$usage += $server->product->price;
|
||||
}
|
||||
|
||||
return number_format($usage, 2, '.', '');
|
||||
}
|
||||
|
||||
private function getServersWithProduct() {
|
||||
return $this->servers()
|
||||
->with('product')
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|string|string[]
|
||||
*/
|
||||
|
|
59
app/Notifications/ReferralNotification.php
Normal file
59
app/Notifications/ReferralNotification.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ReferralNotification extends Notification
|
||||
|
||||
{
|
||||
use Queueable;
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(int $user, int $ref_user)
|
||||
{
|
||||
$this->user = User::findOrFail($user);
|
||||
$this->ref_user = User::findOrFail($ref_user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['database'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
'title' => __("Someone registered using your Code!"),
|
||||
'content' => "
|
||||
<p>You received ".config('SETTINGS::REFERRAL::REWARD')." ".config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME')."</p>
|
||||
<p>because ".$this->ref_user->name." registered with your Referral-Code!</p>
|
||||
<p>Thank you very much for supporting us!.</p>
|
||||
<p>".config('app.name', 'Laravel')."</p>
|
||||
",
|
||||
];
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ use App\Models\Settings;
|
|||
|
||||
return [
|
||||
|
||||
'version' => '0.7.5',
|
||||
'version' => '0.7.6',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
56
database/migrations/2022_06_02_081655_referral_code.php
Normal file
56
database/migrations/2022_06_02_081655_referral_code.php
Normal file
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ReferralCode extends Migration
|
||||
{
|
||||
|
||||
public function generateCode($userid){
|
||||
|
||||
$random = STR::random(8);
|
||||
if (User::where('referral_code', '=', $random)->doesntExist()) {
|
||||
DB::table("users")
|
||||
->where("id", "=", $userid)
|
||||
->update(['referral_code' => $random]);
|
||||
}else{
|
||||
$this->generateCode($userid);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('referral_code')->lenght(8)->nullable();
|
||||
});
|
||||
|
||||
$existing_user = User::where('referral_code', '')->orWhere('referral_code', NULL)->get();
|
||||
|
||||
foreach ($existing_user as $user) {
|
||||
$this->generateCode($user->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('referral_code');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class TableUserReferrals extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_referrals', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('referral_id');
|
||||
$table->unsignedBigInteger('registered_user_id');
|
||||
$table->foreign('referral_id')->references('id')->on('users')->onDelete('cascade');;
|
||||
$table->foreign('registered_user_id')->references('id')->on('users')->onDelete('cascade');;
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_referrals');
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ class SettingsSeeder extends Seeder
|
|||
]);
|
||||
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::USER:NITIAL_SERVER_LIMIT',
|
||||
'key' => 'SETTINGS::USER:INITIAL_SERVER_LIMIT',
|
||||
], [
|
||||
'value' => '1',
|
||||
'type' => 'integer',
|
||||
|
@ -465,5 +465,40 @@ class SettingsSeeder extends Seeder
|
|||
'type' => 'string',
|
||||
'description' => 'Mailer From Name'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::REFERRAL::ENABLED',
|
||||
], [
|
||||
'value' =>"true",
|
||||
'type' => 'string',
|
||||
'description' => 'Enable or disable the referral system'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::REFERRAL::REWARD',
|
||||
], [
|
||||
'value' =>100,
|
||||
'type' => 'integer',
|
||||
'description' => 'Credit reward a user should receive when a user registers with his referral code'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::REFERRAL::ALLOWED',
|
||||
], [
|
||||
'value' =>"client",
|
||||
'type' => 'string',
|
||||
'description' => 'Who should be allowed to to use the referral code. all/client'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::REFERRAL:MODE',
|
||||
], [
|
||||
'value' =>"sign-up",
|
||||
'type' => 'string',
|
||||
'description' => 'Whether referrals get Credits on User-Registration or if a User buys credits'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::REFERRAL:PERCENTAGE',
|
||||
], [
|
||||
'value' =>100,
|
||||
'type' => 'integer',
|
||||
'description' => 'The Percentage Value a referred user gets'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 15 KiB |
Binary file not shown.
Before Width: | Height: | Size: 25 KiB |
BIN
public/images/controlpanel_logo.png
Normal file
BIN
public/images/controlpanel_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 KiB |
|
@ -269,8 +269,8 @@ if (isset($_POST['createUser'])) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
$query1 = "INSERT INTO `" . getEnvironmentValue("DB_DATABASE") . "`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`, `created_at`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass', CURRENT_TIMESTAMP)";
|
||||
$random = generateRandomString();
|
||||
$query1 = "INSERT INTO `" . getEnvironmentValue("DB_DATABASE") . "`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`, `created_at`, `referral_code`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass', CURRENT_TIMESTAMP, '$random')";
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -139,3 +139,14 @@ function wh_log($log_msg)
|
|||
// if you don't add `FILE_APPEND`, the file will be erased each time you add a log
|
||||
file_put_contents($log_file_data, "[" . date('h:i:s') . "] " . $log_msg . "\n", FILE_APPEND);
|
||||
}
|
||||
|
||||
|
||||
function generateRandomString($length = 8) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ echo $cardheader;
|
|||
<label for="databaseuser">Database User</label>
|
||||
<input x-model="databaseuser" id="databaseuser" name="databaseuser" type="text"
|
||||
required
|
||||
value="dashboarduser" class="form-control">
|
||||
value="controlpaneluser" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
@ -159,7 +159,7 @@ echo $cardheader;
|
|||
<div class="custom-control mb-3">
|
||||
<label for="database">Database</label>
|
||||
<input x-model="database" id="database" name="database" type="text" required
|
||||
value="dashboard" class="form-control">
|
||||
value="controlpanel" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -77,22 +77,20 @@
|
|||
@endif</td>
|
||||
<td>
|
||||
<span>
|
||||
@switch($log->description)
|
||||
@case('created')
|
||||
@if(str_starts_with($log->description,"created"))
|
||||
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
||||
@break
|
||||
@case('redeemed')
|
||||
@elseif(str_starts_with($log->description,"redeemed"))
|
||||
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
||||
@break
|
||||
@case('deleted')
|
||||
@elseif(str_starts_with($log->description,"deleted"))
|
||||
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
||||
@break
|
||||
@case('updated')
|
||||
@elseif(str_starts_with($log->description,"gained"))
|
||||
<small><i class="fas text-success fa-money-bill mr-2"></i></small>
|
||||
@elseif(str_starts_with($log->description,"updated"))
|
||||
<small><i class="fas text-info fa-pen mr-2"></i></small>
|
||||
@break
|
||||
@endswitch
|
||||
{{ucfirst($log->description)}}
|
||||
@endif
|
||||
{{ explode("\\" , $log->subject_type)[2]}}
|
||||
{{$log->description}}
|
||||
|
||||
@php $first=true @endphp
|
||||
@foreach(json_decode($log->properties, true) as $properties)
|
||||
@if($first)
|
||||
|
|
|
@ -184,7 +184,72 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 px-3">
|
||||
<div class="row mb-2">
|
||||
<div class="col text-center">
|
||||
<h1>Referral</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="custom-control mb-3 p-0">
|
||||
<div class="col m-0 p-0 d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<input value="true" id="enable_referral" name="enable_referral"
|
||||
{{ config('SETTINGS::REFERRAL::ENABLED') == 'true' ? 'checked' : '' }}
|
||||
type="checkbox">
|
||||
<label for="enable_referral">{{ __('Enable Referral') }} </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="custom-control mb-3 p-0">
|
||||
<label for="referral_mode">{{ __('Mode') }}:
|
||||
<i data-toggle="popover" data-trigger="hover"
|
||||
data-content="{{ __('Should a reward be given if a new User registers or if a new user buys credits') }}" class="fas fa-info-circle"></i>
|
||||
</label>
|
||||
<select id="referral_mode" style="width:100%" class="custom-select" name="referral_mode" required
|
||||
autocomplete="off" @error('referral_mode') is-invalid @enderror>
|
||||
<option value="commission" @if (config('SETTINGS::REFERRAL:MODE') == "commission") selected
|
||||
@endif>{{ __("Commission") }}</option>
|
||||
<option value="sign-up" @if (config('SETTINGS::REFERRAL:MODE') == "sign-up") selected
|
||||
@endif>{{ __("Sign-Up") }}</option>
|
||||
<option value="both" @if (config('SETTINGS::REFERRAL:MODE') == "both") selected
|
||||
@endif>{{ __("Both") }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<div class="custom-control p-0">
|
||||
<label for="referral_percentage">{{ __('Referral reward in percent') }} {{__("(only for commission-mode)")}}:
|
||||
<i data-toggle="popover" data-trigger="hover"
|
||||
data-content="{{ __('If a referred user buys credits, the referral-user will get x% of the Credits the referred user bought') }}" class="fas fa-info-circle"></i>
|
||||
</label>
|
||||
<input x-model="referral_percentage" id="referral_percentage" name="referral_percentage"
|
||||
type="number" value="{{ config('SETTINGS::REFERRAL:PERCENTAGE') }}"
|
||||
class="form-control @error('referral_percentage') is-invalid @enderror">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
<div class="custom-control p-0">
|
||||
<label for="referral_reward">{{ __('Referral reward in') }} {{ config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME', 'Credits') }} {{__("(only for sign-up-mode)")}}:</label>
|
||||
<input x-model="referral_reward" id="referral_reward" name="referral_reward"
|
||||
type="number" value="{{ config('SETTINGS::REFERRAL::REWARD') }}"
|
||||
class="form-control @error('referral_reward') is-invalid @enderror">
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-control mb-3 p-0">
|
||||
<label for="referral_allowed">{{ __('Allowed') }}:
|
||||
<i data-toggle="popover" data-trigger="hover"
|
||||
data-content="{{ __('Who is allowed to see their referral-URL') }}" class="fas fa-info-circle"></i>
|
||||
</label>
|
||||
<select id="referral_allowed" style="width:100%" class="custom-select" name="referral_allowed" required
|
||||
autocomplete="off" @error('referral_allowed') is-invalid @enderror>
|
||||
<option value="everyone" @if (config('SETTINGS::REFERRAL::ALLOWED') == "everyone") selected
|
||||
@endif>{{ __("Everyone") }}</option>
|
||||
<option value="client" @if (config('SETTINGS::REFERRAL::ALLOWED') == "client") selected
|
||||
@endif>{{ __("Clients") }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
<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 @if ($shopProduct->type == 'credits') selected @endif value="Credits">{{ CREDITS_DISPLAY_NAME }}</option>
|
||||
<option @if ($shopProduct->type == 'Server slots') selected @endif value="Server slots">{{__("Server Slots")}}</option>
|
||||
</select>
|
||||
@error('name')
|
||||
<div class="text-danger">
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
<th>{{__('Email')}}</th>
|
||||
<th>{{CREDITS_DISPLAY_NAME}}</th>
|
||||
<th>{{__('Servers')}}</th>
|
||||
<th>{{__("Referrals")}}</th>
|
||||
<th>{{__('Verified')}}</th>
|
||||
<th>{{__('Last seen')}}</th>
|
||||
<th></th>
|
||||
|
@ -90,6 +91,7 @@
|
|||
{data: 'email', name: 'users.email'},
|
||||
{data: 'credits' , name : 'users.credits'},
|
||||
{data: 'servers' , sortable : false},
|
||||
{data: 'referrals'},
|
||||
{data: 'verified' , sortable : false},
|
||||
{data: 'last_seen'},
|
||||
{data: 'actions' , sortable : false},
|
||||
|
|
|
@ -244,8 +244,37 @@
|
|||
@include('admin.servers.table' , ['filter' => '?user=' . $user->id])
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fas fa-user-check mr-2"></i>{{__('Referals')}} ({{__("referral-code")}} : {{$user->referral_code}})</h5>
|
||||
</div>
|
||||
<div class="card-body table-responsive">
|
||||
|
||||
|
||||
@foreach($referrals as $referral)
|
||||
<div class="col-lg-6">
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<label>User ID: {{$referral->id}}</label>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<span style="max-width: 250px;" class="d-inline-block text-truncate">
|
||||
<i class="fas fa-user-check mr-2"></i><a href="{{route("admin.users.show",$referral->id)}}">{{$referral->name}}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<span style="max-width: 250px;" class="d-inline-block text-truncate">
|
||||
<i class="fas fa-clock mr-2"></i>{{$referral->created_at->diffForHumans()}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- END CUSTOM CONTENT -->
|
||||
|
|
|
@ -91,7 +91,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(config('SETTINGS::REFERRAL::ENABLED') == "true")
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" value="{{ \Request::get('ref') }}" class="form-control" name="referral_code" placeholder="{{__('Referral code')}} ( {{__("optional")}} )">
|
||||
<div class="input-group-append">
|
||||
<div class="input-group-text">
|
||||
<span class="fas fa-user-check"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class="input-group mb-3">
|
||||
{!! htmlFormSnippet() !!}
|
||||
@error('g-recaptcha-response')
|
||||
|
|
|
@ -144,22 +144,19 @@
|
|||
as $log)
|
||||
<li class="list-group-item d-flex justify-content-between text-muted">
|
||||
<span>
|
||||
@switch($log->description)
|
||||
@case('created')
|
||||
@if(str_starts_with($log->description,"created"))
|
||||
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
||||
@break
|
||||
@case('redeemed')
|
||||
@elseif(str_starts_with($log->description,"redeemed"))
|
||||
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
||||
@break
|
||||
@case('deleted')
|
||||
@elseif(str_starts_with($log->description,"deleted"))
|
||||
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
||||
@break
|
||||
@case('updated')
|
||||
@elseif(str_starts_with($log->description,"gained"))
|
||||
<small><i class="fas text-success fa-money-bill mr-2"></i></small>
|
||||
@elseif(str_starts_with($log->description,"updated"))
|
||||
<small><i class="fas text-info fa-pen mr-2"></i></small>
|
||||
@break
|
||||
@endswitch
|
||||
{{ ucfirst($log->description) }}
|
||||
@endif
|
||||
{{ explode('\\', $log->subject_type)[2] }}
|
||||
{{ ucfirst($log->description) }}
|
||||
</span>
|
||||
<small>
|
||||
{{ $log->created_at->diffForHumans() }}
|
||||
|
|
|
@ -112,6 +112,9 @@
|
|||
<div class="dropdown-divider"></div>
|
||||
<a href="{{ route('notifications.index') }}"
|
||||
class="dropdown-item dropdown-footer">{{ __('See all Notifications') }}</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a href="{{ route('notifications.readAll') }}"
|
||||
class="dropdown-item dropdown-footer">{{ __('Mark all as read') }}</a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
@ -182,7 +185,7 @@
|
|||
<!-- Brand Logo -->
|
||||
<a href="{{ route('home') }}" class="brand-link">
|
||||
<img width="64" height="64"
|
||||
src="{{ \Illuminate\Support\Facades\Storage::disk('public')->exists('icon.png')? asset('storage/icon.png'): asset('images/bitsec.png') }}"
|
||||
src="{{ \Illuminate\Support\Facades\Storage::disk('public')->exists('icon.png')? asset('storage/icon.png'): asset('images/controlpanel_logo.png') }}"
|
||||
alt="{{ config('app.name', 'Laravel') }} Logo" class="brand-image img-circle"
|
||||
style="opacity: .8">
|
||||
<span class="brand-text font-weight-light">{{ config('app.name', 'Laravel') }}</span>
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
<div class="col-md-8">
|
||||
<p>{{__('All notifications')}}</p>
|
||||
</div>
|
||||
<a class="float-right">
|
||||
<a href="{{route('notifications.readAll')}}"><button class="btn btn-info btn-xs">{{__('Mark all as read')}}</button></a>
|
||||
|
||||
|
||||
@foreach($notifications as $notification)
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
@if (is_null(Auth::user()->discordUser) && strtolower($force_discord_verification) == 'true')
|
||||
@if (!empty(config('SETTINGS::DISCORD:CLIENT_ID')) && !empty(config('SETTINGS::DISCORD:CLIENT_SECRET')))
|
||||
<div class="alert alert-warning p-2 m-2">
|
||||
<h5><i class="icon fas fa-exclamation-circle"></i>{{ __('Required Discord verification!') }}
|
||||
<h5>
|
||||
<i class="icon fas fa-exclamation-circle"></i>{{ __('Required Discord verification!') }}
|
||||
</h5>
|
||||
{{ __('You have not yet verified your discord account') }}
|
||||
<a class="text-primary"
|
||||
|
@ -52,7 +53,8 @@
|
|||
</div>
|
||||
@else
|
||||
<div class="alert alert-danger p-2 m-2">
|
||||
<h5><i class="icon fas fa-exclamation-circle"></i>{{ __('Required Discord verification!') }}
|
||||
<h5>
|
||||
<i class="icon fas fa-exclamation-circle"></i>{{ __('Required Discord verification!') }}
|
||||
</h5>
|
||||
{{ __('Due to system settings you are required to verify your discord account!') }} <br>
|
||||
{{ __('It looks like this hasnt been set-up correctly! Please contact support.') }}'
|
||||
|
@ -73,7 +75,8 @@
|
|||
<div class="col-12 col-sm-auto mb-4">
|
||||
<div class="slim rounded-circle border-secondary border text-gray-dark"
|
||||
data-label="Change your avatar" data-max-file-size="3"
|
||||
data-save-initial-image="true" style="width: 140px;height:140px; cursor: pointer"
|
||||
data-save-initial-image="true"
|
||||
style="width: 140px;height:140px; cursor: pointer"
|
||||
data-size="140,140">
|
||||
<img src="{{ $user->getAvatar() }}" alt="avatar">
|
||||
</div>
|
||||
|
@ -86,7 +89,8 @@
|
|||
<i data-toggle="popover" data-trigger="hover" data-content="Verified"
|
||||
class="text-success fas fa-check-circle"></i>
|
||||
@else
|
||||
<i data-toggle="popover" data-trigger="hover" data-content="Not verified"
|
||||
<i data-toggle="popover" data-trigger="hover"
|
||||
data-content="Not verified"
|
||||
class="text-danger fas fa-exclamation-circle"></i>
|
||||
@endif
|
||||
|
||||
|
@ -95,10 +99,27 @@
|
|||
<span class="badge badge-primary"><i
|
||||
class="fa fa-coins mr-2"></i>{{ $user->Credits() }}</span>
|
||||
</div>
|
||||
|
||||
@if(config('SETTINGS::REFERRAL::ENABLED') == "true")
|
||||
@if((config('SETTINGS::REFERRAL::ALLOWED') == "client" && $user->role != "member") || config('SETTINGS::REFERRAL::ALLOWED') == "everyone")
|
||||
<div class="mt-1">
|
||||
<span class="badge badge-success"><i
|
||||
class="fa fa-user-check mr-2"></i>
|
||||
{{_("Referral URL")}} :
|
||||
<span onclick="onClickCopy()" id="RefLink" style="cursor: pointer;">
|
||||
{{route("register")}}?ref={{$user->referral_code}}</span>
|
||||
</span>
|
||||
@else
|
||||
<span class="badge badge-warning"><i
|
||||
class="fa fa-user-check mr-2"></i>
|
||||
{{_("Make a purchase to reveal your referral-URL")}}</span>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="text-center text-sm-right"><span
|
||||
class="badge badge-secondary">{{ $user->role }}</span>
|
||||
class="badge {{$badgeColor}}">{{ $user->role }}</span>
|
||||
<div class="text-muted">
|
||||
<small>{{ $user->created_at->isoFormat('LL') }}</small>
|
||||
</div>
|
||||
|
@ -169,7 +190,8 @@
|
|||
<label>{{ __('Current Password') }}</label>
|
||||
<input
|
||||
class="form-control @error('current_password') is-invalid @enderror"
|
||||
name="current_password" type="password" placeholder="••••••">
|
||||
name="current_password" type="password"
|
||||
placeholder="••••••">
|
||||
|
||||
@error('current_password')
|
||||
<div class="invalid-feedback">
|
||||
|
@ -245,7 +267,8 @@
|
|||
</p>
|
||||
</div>
|
||||
<div class="p-3"><img width="100px"
|
||||
height="100px" class="rounded-circle"
|
||||
height="100px"
|
||||
class="rounded-circle"
|
||||
src="{{ $user->discordUser->getAvatar() }}"
|
||||
alt="avatar"></div>
|
||||
</div>
|
||||
|
@ -283,5 +306,30 @@
|
|||
</div>
|
||||
</section>
|
||||
<!-- END CONTENT -->
|
||||
|
||||
<script>
|
||||
function onClickCopy() {
|
||||
let textToCopy = document.getElementById('RefLink').innerText;
|
||||
if(navigator.clipboard) {
|
||||
navigator.clipboard.writeText(textToCopy).then(() => {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: '{{ __("URL copied to clipboard")}}',
|
||||
position: 'top-middle',
|
||||
showConfirmButton: false,
|
||||
background: '#343a40',
|
||||
toast: false,
|
||||
timer: 1000,
|
||||
timerProgressBar: true,
|
||||
didOpen: (toast) => {
|
||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
console.log('Browser Not compatible')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
|||
})->middleware(['auth', 'throttle:3,1'])->name('verification.send');
|
||||
|
||||
#normal routes
|
||||
Route::get('notifications/readAll',[NotificationController::class,'readAll'])->name('notifications.readAll');
|
||||
Route::resource('notifications', NotificationController::class);
|
||||
Route::resource('servers', ServerController::class);
|
||||
Route::resource('profile', ProfileController::class);
|
||||
|
|
Loading…
Reference in a new issue