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 Database\Factories\UserSSHKeyFactory;
|
|
|
|
|
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
|
|
|
|
|
* @property User $user
|
2022-05-22 14:10:01 -04:00
|
|
|
*
|
2025-09-08 13:12:33 -04:00
|
|
|
* @method static Builder|UserSSHKey newModelQuery()
|
|
|
|
|
* @method static Builder|UserSSHKey newQuery()
|
2022-05-14 17:31:53 -04:00
|
|
|
* @method static \Illuminate\Database\Query\Builder|UserSSHKey onlyTrashed()
|
2025-09-08 13:12:33 -04:00
|
|
|
* @method static Builder|UserSSHKey query()
|
|
|
|
|
* @method static Builder|UserSSHKey whereCreatedAt($value)
|
|
|
|
|
* @method static Builder|UserSSHKey whereDeletedAt($value)
|
|
|
|
|
* @method static Builder|UserSSHKey whereFingerprint($value)
|
|
|
|
|
* @method static Builder|UserSSHKey whereId($value)
|
|
|
|
|
* @method static Builder|UserSSHKey whereName($value)
|
|
|
|
|
* @method static Builder|UserSSHKey wherePublicKey($value)
|
|
|
|
|
* @method static Builder|UserSSHKey whereUpdatedAt($value)
|
|
|
|
|
* @method static Builder|UserSSHKey whereUserId($value)
|
2022-05-14 17:31:53 -04:00
|
|
|
* @method static \Illuminate\Database\Query\Builder|UserSSHKey withTrashed()
|
|
|
|
|
* @method static \Illuminate\Database\Query\Builder|UserSSHKey withoutTrashed()
|
2025-09-08 13:12:33 -04:00
|
|
|
* @method static UserSSHKeyFactory factory(...$parameters)
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|