Fix Ticket System
Fix Ticket System
This commit is contained in:
commit
70f4ff13c1
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\Models\Settings;
|
|
||||||
|
|
||||||
class Verified
|
class Verified
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -19,12 +17,14 @@ class Verified
|
||||||
/**
|
/**
|
||||||
* Handle the event.
|
* Handle the event.
|
||||||
*
|
*
|
||||||
* @param object $event
|
* @param object $event
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function handle($event)
|
public function handle($event)
|
||||||
{
|
{
|
||||||
$event->user->increment('server_limit', config('SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL'));
|
if (!$event->user->email_verified_reward) {
|
||||||
$event->user->increment('credits', config('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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,13 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getServersWithProduct()
|
||||||
|
{
|
||||||
|
return $this->servers()
|
||||||
|
->with('product')
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -242,12 +273,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
return number_format($usage, 2, '.', '');
|
return number_format($usage, 2, '.', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getServersWithProduct() {
|
|
||||||
return $this->servers()
|
|
||||||
->with('product')
|
|
||||||
->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array|string|string[]
|
* @return array|string|string[]
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Settings;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'version' => '0.8.3.1',
|
'version' => '0.8.3.2',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -43,7 +41,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'debug' => (bool) env('APP_DEBUG', false),
|
'debug' => (bool)env('APP_DEBUG', false),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -85,7 +83,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'locale' =>"en",
|
'locale' => "en",
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -98,7 +96,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'available_locales' => array_map('basename', preg_replace('/\\.[^.\\s]{3,4}$/', '', glob(resource_path()."/lang/*.json", GLOB_BRACE))),
|
'available_locales' => array_map('basename', preg_replace('/\\.[^.\\s]{3,4}$/', '', glob(resource_path() . "/lang/*.json", GLOB_BRACE))),
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -25,11 +25,12 @@ class UserFactory extends Factory
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->name,
|
'name' => $this->faker->name,
|
||||||
'email' => $this->faker->unique()->safeEmail,
|
'email' => $this->faker->unique()->safeEmail,
|
||||||
'credits' => $this->faker->numberBetween(0,1500),
|
'credits' => $this->faker->numberBetween(0, 1500),
|
||||||
'last_seen' => $this->faker->dateTimeBetween(now(), '+30 days'),
|
'last_seen' => $this->faker->dateTimeBetween(now(), '+30 days'),
|
||||||
'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,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
41
database/migrations/2022_11_29_075851_email_verify_d_b.php
Normal file
41
database/migrations/2022_11_29_075851_email_verify_d_b.php
Normal 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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
||||||
|
@ -30,11 +32,12 @@
|
||||||
<div class="small-box bg-dark">
|
<div class="small-box bg-dark">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
<h3>{{$user->discordUser->username}} <sup>{{$user->discordUser->locale}}</sup> </h3>
|
<h3>{{$user->discordUser->username}} <sup>{{$user->discordUser->locale}}</sup></h3>
|
||||||
<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>
|
||||||
|
@ -246,14 +252,15 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</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')}}
|
||||||
</div>
|
({{__("referral-code")}}: {{$user->referral_code}})</h5>
|
||||||
<div class="card-body table-responsive">
|
</div>
|
||||||
|
<div class="card-body table-responsive">
|
||||||
|
|
||||||
|
|
||||||
@foreach($referrals as $referral)
|
@foreach($referrals as $referral)
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
|
@ -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">
|
||||||
|
@ -271,17 +279,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- END CUSTOM CONTENT -->
|
<!-- END CUSTOM CONTENT -->
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<!-- END CONTENT -->
|
<!-- END CONTENT -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
Loading…
Reference in a new issue