chore: Update to latest cpgg

This commit is contained in:
IceToast 2022-12-19 15:13:19 +01:00
commit 13b9d964a4
7 changed files with 112 additions and 41 deletions

View file

@ -20,7 +20,7 @@
![](https://img.shields.io/endpoint?label=v0.8%20Installations&url=https%3A%2F%2Fmarket.controlpanel.gg%2Fcallhome.php%3Fgetinstalls) ![](https://img.shields.io/endpoint?label=v0.8%20Installations&url=https%3A%2F%2Fmarket.controlpanel.gg%2Fcallhome.php%3Fgetinstalls)
![](https://img.shields.io/badge/Overall%20Installations-2500%2B-green) ![](https://img.shields.io/badge/Overall%20Installations-3500%2B-green)
![](https://img.shields.io/github/stars/ControlPanel-gg/dashboard) ![](https://img.shields.io/github/forks/ControlPanel-gg/dashboard) ![](https://img.shields.io/github/tag/ControlPanel-gg/dashboard) [![Crowdin](https://badges.crowdin.net/controlpanelgg/localized.svg)](https://crowdin.com/project/controlpanelgg) ![](https://img.shields.io/github/issues/ControlPanel-gg/dashboard) ![](https://img.shields.io/github/license/ControlPanel-gg/dashboard) ![](https://img.shields.io/discord/787829714483019826) ![](https://img.shields.io/github/stars/ControlPanel-gg/dashboard) ![](https://img.shields.io/github/forks/ControlPanel-gg/dashboard) ![](https://img.shields.io/github/tag/ControlPanel-gg/dashboard) [![Crowdin](https://badges.crowdin.net/controlpanelgg/localized.svg)](https://crowdin.com/project/controlpanelgg) ![](https://img.shields.io/github/issues/ControlPanel-gg/dashboard) ![](https://img.shields.io/github/license/ControlPanel-gg/dashboard) ![](https://img.shields.io/discord/787829714483019826)
## About ## About

View file

@ -2,8 +2,6 @@
namespace App\Listeners; namespace App\Listeners;
use App\Models\Settings;
class Verified class Verified
{ {
/** /**
@ -24,7 +22,9 @@ class Verified
*/ */
public function handle($event) public function handle($event)
{ {
if (!$event->user->email_verified_reward) {
$event->user->increment('server_limit', config('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', config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL')); $event->user->increment('credits', config('SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL'));
} }
} }
}

View file

@ -3,7 +3,6 @@
namespace App\Models; namespace App\Models;
use App\Classes\Pterodactyl; use App\Classes\Pterodactyl;
use App\Events\UserUpdateCreditsEvent;
use App\Notifications\Auth\QueuedVerifyEmail; use App\Notifications\Auth\QueuedVerifyEmail;
use App\Notifications\WelcomeMessage; use App\Notifications\WelcomeMessage;
use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Contracts\Auth\MustVerifyEmail;
@ -110,8 +109,17 @@ class User extends Authenticatable implements MustVerifyEmail
} }
}); });
$user->tickets()->chunk(10, function ($tickets) {
foreach ($tickets as $ticket) {
$ticket->delete();
}
});
$user->ticketBlackList()->delete();
$user->vouchers()->detach(); $user->vouchers()->detach();
$user->discordUser()->delete(); $user->discordUser()->delete();
Pterodactyl::client()->delete("/application/users/{$user->pterodactyl_id}"); Pterodactyl::client()->delete("/application/users/{$user->pterodactyl_id}");
@ -134,6 +142,22 @@ class User extends Authenticatable implements MustVerifyEmail
return $this->hasMany(Payment::class); return $this->hasMany(Payment::class);
} }
/**
* @return HasMany
*/
public function tickets()
{
return $this->hasMany(Ticket::class);
}
/**
* @return HasMany
*/
public function ticketBlackList()
{
return $this->hasMany(TicketBlacklist::class);
}
/** /**
* @return BelongsToMany * @return BelongsToMany
*/ */
@ -209,6 +233,15 @@ class User extends Authenticatable implements MustVerifyEmail
return $this; return $this;
} }
private function getServersWithProduct()
{
return $this->servers()
->whereNull('suspended')
->whereNull('cancelled')
->with('product')
->get();
}
/** /**
* @return string * @return string
*/ */
@ -242,14 +275,6 @@ class User extends Authenticatable implements MustVerifyEmail
return number_format($usage, 2, '.', ''); return number_format($usage, 2, '.', '');
} }
private function getServersWithProduct() {
return $this->servers()
->whereNull('suspended')
->whereNull('cancelled')
->with('product')
->get();
}
/** /**
* @return array|string|string[] * @return array|string|string[]
*/ */

View file

@ -1,10 +1,8 @@
<?php <?php
use App\Models\Settings;
return [ return [
'version' => '0.8.3.1', 'version' => '0.8.3.2',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View file

@ -30,6 +30,7 @@ class UserFactory extends Factory
'email_verified_at' => $this->faker->dateTimeBetween('-30 days', now()), 'email_verified_at' => $this->faker->dateTimeBetween('-30 days', now()),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10), 'remember_token' => Str::random(10),
'email_verified' => true,
]; ];
} }
} }

View file

@ -0,0 +1,41 @@
<?php
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class EmailVerifyDB extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('email_verified_reward')->default(false);
});
$existing_user = User::whereNotNull('email_verified_at')->get();
foreach ($existing_user as $user) {
$user->email_verified_reward = true;
$user->save();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('email_verified_reward');
});
}
}

View file

@ -12,7 +12,9 @@
<ol class="breadcrumb float-sm-right"> <ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li> <li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
<li class="breadcrumb-item"><a href="{{route('admin.users.index')}}">{{__('Users')}}</a></li> <li class="breadcrumb-item"><a href="{{route('admin.users.index')}}">{{__('Users')}}</a></li>
<li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.users.show' , $user->id)}}">{{__('Show')}}</a></li> <li class="breadcrumb-item"><a class="text-muted"
href="{{route('admin.users.show' , $user->id)}}">{{__('Show')}}</a>
</li>
</ol> </ol>
</div> </div>
</div> </div>
@ -34,7 +36,8 @@
<p>{{$user->discordUser->id}} <p>{{$user->discordUser->id}}
</p> </p>
</div> </div>
<div class="p-3"><img width="100px" height="100px" class="rounded-circle" src="{{$user->discordUser->getAvatar()}}" alt="avatar"></div> <div class="p-3"><img width="100px" height="100px" class="rounded-circle"
src="{{$user->discordUser->getAvatar()}}" alt="avatar"></div>
</div> </div>
<div class="small-box-footer"> <div class="small-box-footer">
<i class="fab fa-discord mr-1"></i>Discord <i class="fab fa-discord mr-1"></i>Discord
@ -221,15 +224,18 @@
</div> </div>
<div class="col-lg-8"> <div class="col-lg-8">
<span style="max-width: 250px;" class="d-inline-block text-truncate"> <span style="max-width: 250px;" class="d-inline-block text-truncate">
@if($user->last_seen) {{$user->last_seen->diffForHumans()}} @else <small @if($user->last_seen)
class="text-muted">Null</small> @endif {{$user->last_seen->diffForHumans()}}
@else
<small
class="text-muted">Null</small>
@endif
</span> </span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@ -248,7 +254,8 @@
</div> </div>
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h5 class="card-title"><i class="fas fa-user-check mr-2"></i>{{__('Referals')}} ({{__("referral-code")}}: {{$user->referral_code}})</h5> <h5 class="card-title"><i class="fas fa-user-check mr-2"></i>{{__('Referals')}}
({{__("referral-code")}}: {{$user->referral_code}})</h5>
</div> </div>
<div class="card-body table-responsive"> <div class="card-body table-responsive">
@ -261,7 +268,8 @@
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
<span style="max-width: 250px;" class="d-inline-block text-truncate"> <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> <i class="fas fa-user-check mr-2"></i><a
href="{{route("admin.users.show",$referral->id)}}">{{$referral->name}}</a>
</span> </span>
</div> </div>
<div class="col-lg-4"> <div class="col-lg-4">
@ -282,6 +290,4 @@
</section> </section>
<!-- END CONTENT --> <!-- END CONTENT -->
@endsection @endsection