chore: add phpstan static analysis minimum (#4511)

This commit is contained in:
Lance Pioch 2022-11-28 11:56:03 -05:00 committed by GitHub
parent 3f7e2a565f
commit a1a52754ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 561 additions and 279 deletions

View file

@ -11,6 +11,7 @@ use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Builder;
use Pterodactyl\Models\Traits\HasAccessTokens;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Pterodactyl\Traits\Helpers\AvailableLanguages;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\Access\Authorizable;
@ -129,6 +130,10 @@ class User extends Model implements
'root_admin',
];
protected $appends = [
'md5',
];
/**
* Cast values to correct type.
*/
@ -259,6 +264,13 @@ class User extends Model implements
return $this->morphToMany(ActivityLog::class, 'subject', 'activity_log_subjects');
}
public function md5(): Attribute
{
return Attribute::make(
get: fn () => md5(strtolower($this->email)),
);
}
/**
* Returns all the servers that a user can access by way of being the owner of the
* server, or because they are assigned as a subuser for that server.