Files
pterodactyl-panel/app/Models/Extension.php
T

51 lines
1.4 KiB
PHP
Raw Normal View History

2026-10-05 18:10:18 -04:00
<?php
declare(strict_types=1);
namespace Pterodactyl\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Attributes\Fillable;
/**
* Install-state record for an extension package on disk.
*
* @property int $id
* @property string $identifier
* @property string $version
* @property bool $enabled
* @property string|null $error
2026-10-11 03:10:18 -04:00
* @property string|null $error_phase where the last failure happened: a load phase (register, boot, compatibility) or a runtime one
* @property Carbon|null $errored_at
2026-10-05 18:10:18 -04:00
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*/
2026-10-11 03:10:18 -04:00
#[Fillable(['identifier', 'version', 'enabled', 'error', 'error_phase', 'errored_at'])]
2026-10-05 18:10:18 -04:00
class Extension extends Model
{
public const string RESOURCE_NAME = 'extension';
2026-10-11 03:10:18 -04:00
/**
* Failures that come from loading the extension. Each boot checks these again, so a
* clean boot clears them; any other failure stays until the extension is next
* enabled, disabled or installed.
*
* @var list<string>
*/
public const array LOAD_PHASES = ['register', 'boot', 'compatibility'];
/** No failure recorded. */
public const array NO_ERROR = ['error' => null, 'error_phase' => null, 'errored_at' => null];
2026-10-05 18:10:18 -04:00
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'enabled' => 'bool',
2026-10-11 03:10:18 -04:00
'errored_at' => 'datetime',
2026-10-05 18:10:18 -04:00
];
}
}