Files
pterodactyl-panel/app/Models/Traits/HasHashid.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

28 lines
533 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Models\Traits;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Pterodactyl\Facades\Hashids;
/**
* Expose the model's primary key as a hashid encoded string.
*
* @property-read string $hashid
*
* @mixin Model
*/
trait HasHashid
{
/**
* @return Attribute<string, never>
*/
protected function hashid(): Attribute
{
return Attribute::get(fn (): string => Hashids::encode($this->getKey()));
}
}