Use new attribute casting

This commit is contained in:
Lance Pioch 2022-10-24 12:01:26 -04:00
parent e49ba65709
commit 8a526539be
7 changed files with 88 additions and 80 deletions

View file

@ -2,6 +2,7 @@
namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -55,9 +56,11 @@ class Subuser extends Model
/**
* Return a hashid encoded string to represent the ID of the subuser.
*/
public function getHashidAttribute(): string
public function hashid(): Attribute
{
return app()->make('hashids')->encode($this->id);
return Attribute::make(
get: fn () => app()->make('hashids')->encode($this->id),
);
}
/**