fix: 🚑️ Delete all Tickets on user deletion
This commit is contained in:
parent
c1a2c34a06
commit
7283f6e887
|
@ -94,23 +94,16 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
});
|
});
|
||||||
|
|
||||||
static::deleting(function (User $user) {
|
static::deleting(function (User $user) {
|
||||||
$user->servers()->chunk(10, function ($servers) {
|
|
||||||
foreach ($servers as $server) {
|
|
||||||
$server->delete();
|
// delete every server the user owns without using chunks
|
||||||
}
|
$user->servers()->each(function ($server) {
|
||||||
|
$server->delete();
|
||||||
});
|
});
|
||||||
|
|
||||||
$user->payments()->chunk(10, function ($payments) {
|
$user->payments()->delete();
|
||||||
foreach ($payments as $payment) {
|
|
||||||
$payment->delete();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$user->tickets()->chunk(10, function ($tickets) {
|
$user->tickets()->delete();
|
||||||
foreach ($tickets as $ticket) {
|
|
||||||
$ticket->delete();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$user->ticketBlackList()->delete();
|
$user->ticketBlackList()->delete();
|
||||||
|
|
||||||
|
@ -238,17 +231,17 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
public function getAvatar()
|
public function getAvatar()
|
||||||
{
|
{
|
||||||
//TODO loading the images to confirm they exist is causing to much load time. alternative has to be found :) maybe onerror tag on the <img tags>
|
//TODO loading the images to confirm they exist is causing to much load time. alternative has to be found :) maybe onerror tag on the <img tags>
|
||||||
// if ($this->discordUser()->exists()) {
|
// if ($this->discordUser()->exists()) {
|
||||||
// if(@getimagesize($this->discordUser->getAvatar())) {
|
// if(@getimagesize($this->discordUser->getAvatar())) {
|
||||||
// $avatar = $this->discordUser->getAvatar();
|
// $avatar = $this->discordUser->getAvatar();
|
||||||
// } else {
|
// } else {
|
||||||
// $avatar = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email)));
|
// $avatar = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email)));
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// $avatar = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email)));
|
// $avatar = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->email)));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return 'https://www.gravatar.com/avatar/'.md5(strtolower(trim($this->email)));
|
return 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($this->email)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,9 +291,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
public function getActivitylogOptions(): LogOptions
|
public function getActivitylogOptions(): LogOptions
|
||||||
{
|
{
|
||||||
return LogOptions::defaults()
|
return LogOptions::defaults()
|
||||||
-> logOnly(['role', 'name', 'server_limit', 'pterodactyl_id', 'email'])
|
->logOnly(['role', 'name', 'server_limit', 'pterodactyl_id', 'email'])
|
||||||
-> logOnlyDirty()
|
->logOnlyDirty()
|
||||||
-> dontSubmitEmptyLogs();
|
->dontSubmitEmptyLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue