Use new attribute casting
This commit is contained in:
parent
e49ba65709
commit
8a526539be
7 changed files with 88 additions and 80 deletions
|
@ -5,6 +5,7 @@ namespace Pterodactyl\Models;
|
|||
use Cron\CronExpression;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
||||
|
@ -133,9 +134,11 @@ class Schedule extends Model
|
|||
/**
|
||||
* Return a hashid encoded string to represent the ID of the schedule.
|
||||
*/
|
||||
public function getHashidAttribute(): string
|
||||
public function hashid(): Attribute
|
||||
{
|
||||
return Container::getInstance()->make(HashidsInterface::class)->encode($this->id);
|
||||
return Attribute::make(
|
||||
get: fn () => Container::getInstance()->make(HashidsInterface::class)->encode($this->id),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue