2022-05-14 17:31:53 -04:00
|
|
|
<?php
|
|
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
namespace App\Models;
|
2022-05-14 17:31:53 -04:00
|
|
|
|
2025-01-30 16:39:00 -05:00
|
|
|
use App\Traits\HasValidation;
|
2025-09-24 13:34:19 +02:00
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
2025-01-30 16:39:00 -05:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2022-05-14 17:31:53 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2025-09-24 13:34:19 +02:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
use Illuminate\Support\Carbon;
|
2022-05-14 17:31:53 -04:00
|
|
|
|
|
|
|
|
/**
|
2024-03-12 22:39:16 -04:00
|
|
|
* \App\Models\UserSSHKey.
|
2022-05-14 17:31:53 -04:00
|
|
|
*
|
|
|
|
|
* @property int $id
|
|
|
|
|
* @property int $user_id
|
|
|
|
|
* @property string $name
|
|
|
|
|
* @property string $fingerprint
|
|
|
|
|
* @property string $public_key
|
2025-09-08 13:12:33 -04:00
|
|
|
* @property Carbon|null $created_at
|
|
|
|
|
* @property Carbon|null $updated_at
|
|
|
|
|
* @property Carbon|null $deleted_at
|
2026-03-17 09:09:01 +01:00
|
|
|
* @property-read User $user
|
2022-05-22 14:10:01 -04:00
|
|
|
*
|
2026-03-17 09:09:01 +01:00
|
|
|
* @method static \Database\Factories\UserSSHKeyFactory factory($count = null, $state = [])
|
|
|
|
|
* @method static Builder<static>|UserSSHKey newModelQuery()
|
|
|
|
|
* @method static Builder<static>|UserSSHKey newQuery()
|
|
|
|
|
* @method static Builder<static>|UserSSHKey onlyTrashed()
|
|
|
|
|
* @method static Builder<static>|UserSSHKey query()
|
|
|
|
|
* @method static Builder<static>|UserSSHKey whereCreatedAt($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey whereDeletedAt($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey whereFingerprint($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey whereId($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey whereName($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey wherePublicKey($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey whereUpdatedAt($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey whereUserId($value)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey withTrashed(bool $withTrashed = true)
|
|
|
|
|
* @method static Builder<static>|UserSSHKey withoutTrashed()
|
2022-05-14 17:31:53 -04:00
|
|
|
*/
|
|
|
|
|
class UserSSHKey extends Model
|
|
|
|
|
{
|
2025-01-30 16:39:00 -05:00
|
|
|
use HasFactory;
|
|
|
|
|
use HasValidation;
|
2022-05-14 17:31:53 -04:00
|
|
|
use SoftDeletes;
|
|
|
|
|
|
|
|
|
|
public const RESOURCE_NAME = 'ssh_key';
|
|
|
|
|
|
|
|
|
|
protected $table = 'user_ssh_keys';
|
|
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'name',
|
|
|
|
|
'public_key',
|
|
|
|
|
'fingerprint',
|
|
|
|
|
];
|
|
|
|
|
|
2025-03-08 19:56:06 -05:00
|
|
|
/** @var array<array-key, string[]> */
|
2022-10-14 10:59:20 -06:00
|
|
|
public static array $validationRules = [
|
2022-05-14 17:31:53 -04:00
|
|
|
'name' => ['required', 'string'],
|
|
|
|
|
'fingerprint' => ['required', 'string'],
|
|
|
|
|
'public_key' => ['required', 'string'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public function user(): BelongsTo
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
|
}
|
|
|
|
|
}
|