2022-05-14 17:31:53 -04:00
|
|
|
<?php
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2022-05-14 17:31:53 -04:00
|
|
|
namespace Pterodactyl\Models;
|
|
|
|
|
|
2026-10-11 22:55:07 -04:00
|
|
|
use Carbon\CarbonImmutable;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Database\Factories\UserSSHKeyFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Table;
|
2024-10-21 19:18:20 -06:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2022-05-14 17:31:53 -04:00
|
|
|
|
|
|
|
|
/**
|
2026-10-11 22:55:07 -04:00
|
|
|
* Larastan does not read #[Table], so it cannot find this model's columns.
|
2022-05-14 17:31:53 -04:00
|
|
|
*
|
|
|
|
|
* @property string $name
|
|
|
|
|
* @property string $fingerprint
|
|
|
|
|
* @property string $public_key
|
2026-10-11 22:55:07 -04:00
|
|
|
* @property CarbonImmutable|null $created_at
|
2022-05-14 17:31:53 -04:00
|
|
|
*/
|
2026-10-05 18:10:18 -04:00
|
|
|
#[Fillable([
|
|
|
|
|
'name',
|
|
|
|
|
'public_key',
|
|
|
|
|
'fingerprint',
|
|
|
|
|
])]
|
|
|
|
|
#[Table(name: 'user_ssh_keys')]
|
2022-05-14 17:31:53 -04:00
|
|
|
class UserSSHKey extends Model
|
|
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
/** @use HasFactory<UserSSHKeyFactory> */
|
2024-10-21 19:18:20 -06:00
|
|
|
use HasFactory;
|
2022-05-14 17:31:53 -04:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
use SoftDeletes;
|
2022-05-14 17:31:53 -04:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
public const string RESOURCE_NAME = 'ssh_key';
|
2022-05-14 17:31:53 -04:00
|
|
|
|
2025-12-20 15:55:13 -08:00
|
|
|
/**
|
2026-10-05 18:10:18 -04:00
|
|
|
* @return BelongsTo<User, $this>
|
2025-12-20 15:55:13 -08:00
|
|
|
*/
|
2022-05-14 17:31:53 -04:00
|
|
|
public function user(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
|
}
|
|
|
|
|
}
|